title: Is there a class array?
body: <p>I am making a platformer game and I am wondering if there is a simpler way to store objects in arrays as I use the arrays to check for collision.
  Is there any type of array a class can automatically have?</p>
  <pre><code>//This is with making my own array
  var obstacleArray = [];
  class Obstacle {
      constructor(x, y) {
          this.x = x,
          this.y = y,
          this.width = 50,
          this.height = 50
      }
      
      addToArray() {
          obstacleArray.push(this);
      }
  }
  obstacle1 = new Obstacle(0, 0);
  obstacle2 = new Obstacle(50, 0);
  obstacle1.addToArray();
  obstacle2.addToArray();
  for (let i = 0; i &lt; obstacleArray.length;i++) {
      //check for collision
  }
  </code></pre>
  <p>Is there some kind of built-in array for a number of variables a class owns so I can quickly check for collision without having to call the addToArray function for every obstacle?</p>