js draw square to canvas
// canvas context.fillRect(x, y, height, width);
ctx.fillRect(20, 20, 150, 100);
js draw square to canvas
// canvas context.fillRect(x, y, height, width);
ctx.fillRect(20, 20, 150, 100);
how to draw rectangle in html
<div style="width:500px;height:100px;border:1px solid #000;">This is a rectangle!</div>
draw rectangle on canvas javascript
//Assuming you have canvas and context (ctx) set up:
ctx.fillStyle = "(enter color)";
ctx.fillRect(x, y, width, height);
//to set up canvas and context:
var canvas = document.getElementById("(enter canvas's id)");
var ctx = canvas.getContext("2d");
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us