Skip to content

Instantly share code, notes, and snippets.

@g-patel
Last active September 17, 2016 07:04
Show Gist options
  • Save g-patel/2c03fd3aae23d572fdac51f164dc4d79 to your computer and use it in GitHub Desktop.
Save g-patel/2c03fd3aae23d572fdac51f164dc4d79 to your computer and use it in GitHub Desktop.
If you can tell output of following program, you probably know javascript event loop. Ref: https://mzl.la/1T3wZ3U
(function() {
for(let i=0; i<1000 ;i++) {
setTimeout(function() {
console.log(`Hi`);
}, 0);
}
for(let i=0; i<1000; i++) {
console.log('Hello');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment