Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/8.js
Created Jul 19, 2012

Embed
What would you like to do?
intro/async
var i = 0;
while( ++ i <= 4) {
(function(i) {
setTimeout(function() {
console.log(i);
}, i);
}(i));
}
@heapwolf

This comment has been minimized.

Copy link
Owner Author

commented Jul 19, 2012

Output

1
2
3
4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.