How to use array.push on array with a defined index?
<p>How do I use array.push to add an object with a custom index in an array?</p>

<p>I have this script but it doesnt work. Chrome's Javascript console is not outputting errors</p>

<pre><code>var tempList = new Array();
$('#add').click(function(){
  var split = $('#itemid').val().split('_');
  var itemid = split['0'];
  var lbs = $('#lbs').val();
  tempList.push(tempList['itemid'] = lbs);
  for (var i; i&lt;=(tempList.length - 1); i++){
    if (i==0){
      var list = tempList[i]+ '&lt;br /&gt;';
    } 
    else{
      var list =  list + tempList[i]+ '&lt;br /&gt;';
    }
  }
  alert(list);
});
</code></pre>
