<!DOCTYPE html>
<canvas width="600" height="400"
</canvas>
<script>
var pantalla = document.querySelector("canvas");
var pincel = pantalla.getContext("2d");
function dibujarCuadrado(x1,y1,ancho,alto, color){
pincel.fillStyle = color;
pincel.fillRect(x1,y1,ancho,alto);
pincel.strokeStyle = "black";
pincel.strokeRect(x1,y1,ancho,alto);
}
var x1,x2,y1,y2;
x1 = y1 = 0;
ancho = alto = 50;
for(var i=0; i<10; i++){
y1 += 50;
x1 = 0;
for(var j=0; j<10; j++){
x1 += 50;
dibujarCuadrado(x1,y1,ancho,alto, "purple");
}
}
</script>
</html>