<canvas weidth='600' height='400'></canvas>
<script>
function fracao (x, y, cor) {
var tela = document.querySelector('canvas');
var pincel = tela.getContext ('2d');
pincel.fillStyle = cor;
pincel.fillRect (x, y, 50, 50);
pincel.fillStroke = 'black';
pincel.strokeRect (x, y, 50, 50);
}
for (var x=0; x<150; x = x +50) {
fracao (x, 0,'lightgreen');
}
for (var x = 150; x <200; x = x + 50) {
fracao (x, 0, 'white');
}
</script>