title: Arrow function closure within for loop
body: <p>Given this:</p>
  
  <pre><code>var m = 5;
  
  for (i = 0; i &lt; m; i++) { 
      add_row('row-'+(i+1), () =&gt; f(i))
  }
  </code></pre>
  
  <p>if I do an alert in my <code>f</code> the it will always output the value <code>5</code>. I believe this is due to the same problem mention here for python: </p>
  
  <p><a href="https://stackoverflow.com/questions/7514093/lambda-function-dont-closure-the-parameter-in-python">lambda function don&#39;t closure the parameter in Python?</a>  </p>
  
  <p>How is this problem solved in javascript?</p>