title: Iterating an associative array with jQuery .each
body: <p>Probably the most contributing factor for this question is that I am extremely sleepy right now.</p>
  
  <p>I have an array, which I initiate:</p>
  
  <pre><code>var cells = [];
  </code></pre>
  
  <p>Then i put some values in it (jQuery objects), for example:</p>
  
  <pre><code>$("td").each(function () {
    var td = $(this);
    cells[td.attr("id")] = td;
  });
  </code></pre>
  
  <p>And now my problem. This code:</p>
  
  <pre><code>$(cells).each(function (i) {
    console.log(this) // firebug console
  });
  </code></pre>
  
  <p>logs absolutelly nothing. When i changed the associative array to a normal, number index one by substituting</p>
  
  <pre><code>cells[td.attr("id")] = td;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>cells.push(td);
  </code></pre>
  
  <p>It worked correctly.</p>
  
  <p>Also, when I try to iterate with the for..in loop it works as expected.</p>
  
  <pre><code>for (var cell in cells) {
    console.log(cells[cell]);
  }
  </code></pre>
  
  <p>Doeas that mean that jQuery's .each method does not accept associative arrays or am I doing something wrong?</p>