title: JavaScript Multidimensional Arrays
body: <p>This wasn't the question I was going to ask but I have unexpectedly run aground with JavaScript arrays. I come from a PHP background and after looking at a few websites I am none the wiser.</p>
  
  <p>I am trying to create a multi-dimensional array.</p>
  
  <pre><code>var photos = new Array;
  var a = 0;
  $("#photos img").each(function(i) {
      photos[a]["url"] = this.src;
      photos[a]["caption"] = this.alt;
      photos[a]["background"] = this.css('background-color');
      a++;
  });
  </code></pre>
  
  <p>Error message: photos[a] is undefined. How do I do this? Thanks.</p>