re: JavaScript Closure Simply Explained VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Just a small addition: instead of for(var i=0; i<5; i++) { setTimeout((function(index) { console.log(index) })(i), 1000) } you can...
 

Thanks Jurian! I debated if I should include this solution in my article because I just wanted to focus on closure but I am glad you brought it up :)

code of conduct - report abuse