Skip to content

Instantly share code, notes, and snippets.

@sznowicki
Created July 13, 2018 19:06
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 sznowicki/3368e41636fe2f223b8f7ad771ecd178 to your computer and use it in GitHub Desktop.
Save sznowicki/3368e41636fe2f223b8f7ad771ecd178 to your computer and use it in GitHub Desktop.
Async...await vs promise - getting already resolve promise
const p = new Promise((resolve) => resolve(1));
p.then(r => console.log('promise', r));
async function foo() {
const r = await p;
console.log('async', r);
}
foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment