title: create multidimensional array or object in jquery each loop
body: <p>this is what I've got and been struggeling for hours. if I <code>alert(i)</code>in the each loop it gives me <code>1,2,3...</code> but if I want to use as as key for a multidimensional array it is like a string <code>"i"</code></p>
  
  <pre><code>$(document).ready(function(){
      var positions=[];
  
      $( ".box" ).each(function(i) {
          //alert(i);
          var elPositions = {};
          elPositions.i = $(this).offset().top;
          positions.push(elPositions);
          //$elPosArray[i] = $(this).offset().top;
          //$(this).html('outer height--&gt; ' + $(this).outerHeight(true));
      });
      console.log(positions);
      //console.log(el);
  });
  </code></pre>
  
  <p>There are Questions and answers to this topic but none of them helped me to get this to work.</p>
  
  <p>I would like to get an array or obj looking something like:</p>
  
  <pre><code>   positions[0]['offset'] = '120';
     positions[0]['height'] = '300';
     positions[1]['offset'] = '420';
     positions[1]['height'] = '180';
     positions[2]['offset'] = '600';
     positions[2]['height'] = '100';
     positions[3]['offset'] = '700';
     positions[3]['height'] = '300';
  </code></pre>
  
  <p>Here is a fiddle with the html <a href="http://jsfiddle.net/Z9WrG/" rel="nofollow">http://jsfiddle.net/Z9WrG/</a></p>