Skip to content

Instantly share code, notes, and snippets.

@gillesruppert
Created May 16, 2012 14:48
Show Gist options
  • Save gillesruppert/2710920 to your computer and use it in GitHub Desktop.
Save gillesruppert/2710920 to your computer and use it in GitHub Desktop.
order of setTimeout calls
var i = 0, l = 100;
for (; i < l; i++) {
(function(counter) {
setTimeout(function() {
console.log(counter);
}, 0);
}(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment