title: Uncaught TypeError: Cannot read property 'getContext' of null
body: <p>This is my HTML code, showing the canvas:   </p>
  
  <pre><code> &lt;canvas id="backgroundCanvas" width="550" height=600"&gt;&lt;/canvas&gt;
   &lt;canvas id="playerCanvas" width="550" height=600"&gt;&lt;/canvas
   &lt;canvas id="enemiesCanvas" width="550" height=600"&gt;&lt;/canvas&gt;
  </code></pre>
  
  <p>This is where the problem is said to occur:</p>
  
  <pre><code>game.contextBackground = document.getElementById("backgroundCanvas").getContext("2d"); // line 32
  game.contextPlayer = document.getElementById("playerCanvas").getContext("2d"); // line 33
  game.contextEnemies = document.getElementById("enemiesCanvas").getContext("2d"); // line 34
  </code></pre>
  
  <p>the error occurs on line 34 where it says:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'getContext' of null</p>
  </blockquote>
  
  <p>any help is much appreciated :)</p>