title: Creating dynamic 3d arrays in javascript
body: <p>I was looking to create a dynamic 3D array, here's the basic code I used:</p>
  <pre><code>const arr = new Array;
  arr[0] = new Array;
  arr[0][0] = new Array;
  
  arr[0][0][0] = 'value1';
  arr[1][0][0] = 'value2';
  </code></pre>
  <p>But I noticed that any value greater than 0 for the first 2 indexes throws</p>
  <blockquote>
  <p>Uncaught TypeError: Cannot read property '0' of undefined</p>
  </blockquote>
  <p>(0 is the value of the index following the previous which was greater than 0)</p>
  <p>Is there a way to prevent this from happening without adding new arrays every time a new value is added?</p>