Skip to content

Instantly share code, notes, and snippets.

@sandeep1995
Created July 23, 2018 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeep1995/cca2ab69f38aab0ab8e00706f86cd6c5 to your computer and use it in GitHub Desktop.
Save sandeep1995/cca2ab69f38aab0ab8e00706f86cd6c5 to your computer and use it in GitHub Desktop.
Guess the output of the following javascript code snippet.
const log = (msg) => console.log(msg);
log('First');
Promise.resolve().then(() => {
log('From promise');
})
requestAnimationFrame(() => {
log('From animation frame');
})
setTimeout(() => {
log('From set timeout 0');
}, 0)
setTimeout(() => {
log('From set timeout 15');
}, 15)
log('Last');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment