Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created July 19, 2012 17:45
Show Gist options
  • Save heapwolf/3145587 to your computer and use it in GitHub Desktop.
Save heapwolf/3145587 to your computer and use it in GitHub Desktop.
intro/async
var i = 0;
while( ++ i <= 4) {
setTimeout(function() {
console.log(i);
}, i);
}
@heapwolf
Copy link
Author

Output

5
5
5
5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment