title: console.log() on setTimeout() JS
body: <p>can someone help me understanding why this code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>for (var i =0; i &lt; 2; i++) {
    setTimeout(console.log(i), 0);
  }
  console.log("aaa");</code></pre>
  </div>
  </div>
  </p>
  
  <p>Will write:</p>
  
  <pre><code>0
  1
  aaa
  </code></pre>
  
  <p>But that code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>for (var i =0; i &lt; 2; i++) {
    setTimeout(function(){console.log(i)}, 0);
  }
  console.log("aaa");</code></pre>
  </div>
  </div>
  </p>
  
  <p>Will wirte that:</p>
  
  <pre><code>aaa
  2
  2
  </code></pre>
  
  <p>Note that I understand how the second vers. work, I don't get why the first one make it differnt.</p>
  
  <p>Thanks!</p>