1// canvas context.fillRect(x, y, height, width);
2ctx.fillRect(20, 20, 150, 100);
1//Assuming you have canvas and context (ctx) set up:
2ctx.fillStyle = "(enter color)";
3ctx.fillRect(x, y, width, height);
4//to set up canvas and context:
5var canvas = document.getElementById("(enter canvas's id)");
6var ctx = canvas.getContext("2d");