News for hackers. Stuff that matters.
Re:JavaScript Interview Question by theoretical on Thursday January 20, 2011 @12:57PM (#2124528)
That won't quite work, as you're still just copying the value of i when that function is executed, which will be 4.

You could make the function take a parameter, then return a function which uses that parameter, or use currying.

Edit: I've posted a working version in my comment further down, http://news.ycombinator.com/item?id=2124559

There are no comments on this comment yet.