I am trying to set a DOM element to a variable but when I console.log() the variable, it shows null.
var canvas = document.querySelector('canvas');
console.log(canvas); //null
but it is working perfect in the tutorial I'm following. Can anyone help me out?