How to clear the canvas using clearRect in HTML ?
The clearRect() method of the Canvas 2D API which is used to erase the pixel in a rectangular area by setting the pixel color to transparent black (rgba(0, 0, 0, 0)).Syntax: abc.clearRect(x, y, width, height); Parameters: x, y: These parameter represents the top-left coordinate of the rectangular bo