title: Simple Javascript Closure Issue
body: <p>I know WHY this doesn't work, but can't find the correct way of doing it.</p>
  
  <p>I'm trying to build an object using a loop.
  The Object builds fine, but when I try to use the callback, it alerts "2" for each person, I'd like it to alert the position in the array.</p>
  
  <pre><code>var playerArr = ["steve", "paul", "bob"];
  
  var myAutomatedObj = {};
  for (var i=0; i&lt;playerArr.length; i++){
      var objName = playerArr[i];
      myAutomatedObj[objName] = {};
      myAutomatedObj[objName]["callback"] = function(){
          alert(i);
      }
  }
  
  //returns incorrect alert
  myAutomatedObj.steve.callback();
  </code></pre>