We need to get the reference for canvas object in JavaScript and for that, we will use “id” of canvas and “document.getElementById” method of javascript.
var canvas = document.getElementById(‘foo’);
We need to get the reference for canvas object in JavaScript and for that, we will use “id” of canvas and “document.getElementById” method of javascript.
var canvas = document.getElementById(‘foo’);