ctx.clearRect(0, 0, canvas.width, canvas.height);
//Given that canvas is a canvas element or an OffscreenCanvas object,
const context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
const context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
function clear() {
this.context.clearRect(0, 0, window.innerWidth, window.innerHeight);
}