title: Why is the function output always 5?
body: <p>does anyone know why the output of this code is 5 times 5?</p>
  
  <pre><code>for (var i = 0; i &lt; 5; i++) {
      setTimeout(function() { console.log(i); }, i * 1000 );   
  }
  </code></pre>
  
  <p>The for statement never gets to 5 :S</p>