<!DOCTYPE html>
<html lang="en">
<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>Cuadrados</title>
</head>
<body>
<canvas width="600" height="400"></canvas>
<script>
function dibujarCuadrado(x, y, width, heigth, color, lineaColor) {
var pantalla = document.querySelector("canvas");
var pincel = pantalla.getContext("2d");
pincel.fillStyle = color;
pincel.fillRect(x, y, width, heigth,);
pincel.strokeStyle = lineaColor;
pincel.strokeRect(x, y, width, heigth,);
}
dibujarCuadrado(0, 0, 50, 50, "red", "black");
dibujarCuadrado(50, 0, 50, 50, "yellow", "black");
dibujarCuadrado(100, 0, 50, 50, "green", "black");
</script>
</body>
</html>