Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gskachkov/880ef7983e8f20dd5e73a97d55ce794b to your computer and use it in GitHub Desktop.
Save gskachkov/880ef7983e8f20dd5e73a97d55ce794b to your computer and use it in GitHub Desktop.
Order of async function execution
const foo = async function () {
console.log('before await');
const value = await 'boo';
console.log('after await');
return value;
};
console.log('before async invocation');
foo();
console.log('after async invocation');
// Output
// before async invocation
// before await
// after async invocation
// after await
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment