title: jQuery Create Multidimensional Array
body: <p>I am having a heck of a time trying to figure out how to create a multidimensional array in jQuery. </p>
  
  <p>I instantiate the array outside of the loop. </p>
  
  <pre><code> &lt;script&gt;
   var myArray = [];
   &lt;/script&gt;
  </code></pre>
  
  <p>Inside of my loop I want to add the array elements. </p>
  
  <pre><code> i = 0
   [loop start]
        &lt;script&gt;
        myArray[i][$row[sku]] = $row[qty]; // sku might be repeated will this cause an issue? You will see in the error below "295518" is repeated...
        &lt;script&gt;
   [loop end]
  </code></pre>
  
  <p>In my source code it looks like this: </p>
  
  <pre><code> &lt;script&gt;
   myArray[ 1 ][ 295518 ] = 122;
   &lt;/script&gt;
  </code></pre>
  
  <p>Then I run this at the end outside the loop...</p>
  
  <pre><code> &lt;script&gt;
   console.log( myArray );
   &lt;/script&gt;
  </code></pre>
  
  <p>I get this error in the console: </p>
  
  <pre><code>Uncaught TypeError: Cannot set property '295518' of undefined 
  Uncaught TypeError: Cannot set property '70252' of undefined 
  Uncaught TypeError: Cannot set property '295518' of undefined 
  </code></pre>
  
  <p>What I am doing wrong in setting up this array? Thanks!</p>