const canvas = document.getElementById("canvas_one")
let ctx = canvas.getContext("2d")
// Blue Rectangle
ctx.fillStyle = 'blue';
ctx.fillRect(10, 10, 150, 100);
// Clear Area (Blue Rectangle)
ctx.clearRect(20, 20, 40, 40)
// Red Rectangle
ctx.strokeStyle = "red";
ctx.strokeRect(240, 90, 50, 50)
<canvas id="canvas_one"></canvas>
canvas {
background-color: lightgoldenrodyellow;
}
x, y) = (300, 150)
x,
y) = (0,
0)
getContext('2d')
fillStyle='color'
fillRect(x, y, width, height)
strokeRect(x, y, width,height)
clearRect(x, y, width, height)