title: Looping through an object with incremental property names
body: <p>I'm trying to loop through an object like you would an array. I'm struggling to append the loop counter to the variable name.</p>
  
  <p>I have an object like this (<a href="https://stackoverflow.com/questions/603987/what-is-the-javascript-equivalent-of-var-dump-or-print-r-in-php?lq=1">output with <code>dump()</code>, which I found here</a>):</p>
  
  <pre><code>object(2): {
    elem0:  array(4): {
      [0]:  string(27): "http://placehold.it/300x300"
      [1]:  string(3): "0.8"
      [2]:  string(4): "-150"
      [3]:  string(3): "200"
    }
    elem1:  array(4): {
      [0]:  string(27): "http://placehold.it/300x300"
      [1]:  string(3): "0.6"
      [2]:  string(3): "-70"
      [3]:  string(3): "458"
    }
  }
  </code></pre>
  
  <p>Here's how I'm trying to loop through it:</p>
  
  <pre><code>jQuery(document).ready(function($) {
  
      // Provides object-measuring functionality
      Object.size = function(obj) {
          var size = 0, key;
          for (key in obj) {
              if (obj.hasOwnProperty(key)) size++;
          }
          return size;
      };
  
      // Returns the number of objects in my object
      var size = Object.size(window.depthElems);
  
      /*
      This is where I'm having difficulty.
      I would like to use window.depthElems.elem0,
      then window.depthElems.elem1, etc.
      */
  
      for (var i = 0; i &lt; size; i++) {
          $('.wrapper').append('&lt;img src="' + window.depthElems.elem+i+[0] + '" /&gt;'); 
      }
  
  });
  </code></pre>