Skip to content

Instantly share code, notes, and snippets.

@rom1504
Created December 6, 2020 18:33
Show Gist options
  • Save rom1504/6a9127764b43e38569e704f94ac99908 to your computer and use it in GitHub Desktop.
Save rom1504/6a9127764b43e38569e704f94ac99908 to your computer and use it in GitHub Desktop.
async function execution order
async function f() {
console.log('a')
await new Promise(resolve => setTimeout(resolve, 0))
}
f().then(() => console.log('c'))
console.log('b')
@rom1504
Copy link
Author

rom1504 commented Dec 6, 2020

always outputs a b c

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