title: Javascript what is "index" within an argument?
body: <pre><code> var g = document.getElementById('my_div');
  for (var i = 0, len = g.children.length; i &lt; len; i++)
  {
  
      (function(index){
          g.children[i].onclick = function(){
                alert(index)  ;
          }    
      })(i);
  
  }
  </code></pre>
  
  <p>So I saw the above example that shows how to get the index of the clicked element. I noticed that it uses "index" as a parameter. Unfortunately I am only aware of indexof so how does this work? I cant find anything about "index" when googling: javascript index property or javascript index argument.</p>
  
  <p>Edit: I really didnt see the function call with (i) as it was so small. </p>