Skip to content

Instantly share code, notes, and snippets.

@jackofseattle
Last active December 14, 2015 06:18
Show Gist options
  • Save jackofseattle/5041115 to your computer and use it in GitHub Desktop.
Save jackofseattle/5041115 to your computer and use it in GitHub Desktop.
What is the output of this function? Why?
for(var i = 0; i < 5; i++) {
setTimeout(function() {
console.log('The value of i is ', i);
}, 500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment