title: Cannot read property ____ of null
body: <p>As an exercise, I went through <a href="https://www.sitepoint.com/quick-tip-game-loop-in-javascript/" rel="nofollow noreferrer">this tutorial</a>, then attempted to create a version that puts everything into its own class to clean it up so I can add some of my own additions. The issue is that I am running into an error that doesn't seem to make any sense. (all the commented stuff is filled in on my end, but it didn't seem relevant to the question) <code>Uncaught TypeError: Cannot read property 'lastRender' of null at loop (game-loop.js:13)</code></p>
  
  <pre><code>class GameLoop {
    constructor(player, canvas) {
      // Set other variables
      this.lastRender = 0;
      window.requestAnimationFrame(this.loop);
    }
  
    loop(timestamp) {
      let progress = timestamp - this.lastRender; // This is ln. 13 in the actual program
  
      this.update(progress);
      this.draw();
  
      this.lastRender = timestamp;
      window.requestAnimationFrame(this.loop);
    }
  
    update(progress) {
      // Update function
    }
  
    draw() {
      // Draw function
    }
  
  }
  </code></pre>
  
  <p>Additionally when I remove the lastRender variable from the class, it stops giving me that error, but instead says <code>Uncaught TypeError: Cannot read property 'update' of null at loop (game-loop.js:15)</code></p>