Empresa activa
Analyze a horrible JavaScript function to determine the problems. Essentially a nasty for loop with a setTimeout inside that did a console.log of the loop iterator's value.
Anónimo
Just add a Closure to it. for (var j=0; j< 10; j++) { (function(j) { return setTimeout[function() { console.log(j); }, 100) })(j); }