title: Correct scope reference to object within window object
body: <p>Since my previous question was not answered i thought i give it another try only formulated better.</p>
  
  <pre><code>(function() { 
  
      var ns = {};
  
      for(var i = 0; i &lt; 2; i++){
  
          ns['someName'] = 'na' + i; 
  
          //Logs ns0 and ns1 like i want
          console.log(ns["someName"]);
  
          window.addEventListener('load', function(){
  
              //Logs ns1 twice
              console.log(ns["someName"]);
  
  
          });
  
      }
  
  
  
  })();
  </code></pre>
  
  <p>So the question being how to keep the correct scope within the window eventListener.
  Thanks!</p>