<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<center><canvas id="myCanvas" width="600px" height="400px" style="border: 1px solid #000;"></canvas></center>
<script>
let canvas = document.querySelector("#myCanvas");
let ctx = canvas.getContext('2d');
function lineSquare(x, y, color) {
while (x < 600) {
ctx.fillStyle = color;
ctx.fillRect(x, y, 50, 50);
ctx.strokeStyle = "#000";
ctx.strokeRect(x, y, 50, 50);
x += 50;
}
}
function fullSquare(x, y, color) {
for (; y < 400; y += 50) {
lineSquare(x, y, color);
}
}
fullSquare(0, 50, "#3323d7");
lineSquare(0, 0, "#ee4455");
</script>
</body>
</html>