JQuery Clear Canvas Content

//set a const for all the code 
const context = canvas.getContext('2d');

//to clear the canvas use:
context.clearRect(0, 0, canvas.width, canvas.height);

//if the canvas is with 300 and height 450:
context.clearRect(0, 0, 300, 450);
Ivan The Terrible