Getting confused between closures and eval()
I just saw a question regarding closures in JavaScript regarding code similar to the following:
for (i=0;i<n;i++){
foo.bind( function() { bar(i); } );
}
The question was why does every closure execute bar(i) with i as the value of n for every instance, rather than whatever the value of i was when the closure […]