<canvas width ="600" height="400"></canvas>
<script>
function desenhaquadrado(x, y, cor){
var tela =document.querySelector("canvas");
var pincel = tela.getContext("2d");
pincel.fillStyle = cor;
pincel.fillRect(x, y, 50, 50);
pincel.strokeStyle = 'red';
pincel.fillRect (x, y, 50, 50);
}
for(var x=0; x< 600; x= x + 50){
desenhaquadrado(x, 0, 'grey');
}
</script>