About Me

My photo
Drum & Bass Producer, Software Developer, Love my Cats

HTML5: How to clear canvas

I have an HTML5 canvas element and I want to 'reset' it, clear the content.
How do you clear a canvas element?

1. get the canvas from the DOM:
canvas = document.getElementById("canvas");

2. reset canvas:
canvas.width = canvas.width;