Skip to content

Instantly share code, notes, and snippets.

@itsthatguy
Created May 2, 2017 16:31
Show Gist options
  • Save itsthatguy/b585bddacc16b0244e34bf11c59c2285 to your computer and use it in GitHub Desktop.
Save itsthatguy/b585bddacc16b0244e34bf11c59c2285 to your computer and use it in GitHub Desktop.
function myPromise () {
return new Promise((resolve) => {
setTimeout(() => {
console.log('fourth a');
resolve('fourth b');
}, 200);
});
}
async function second () {
console.log('second')
const foo = await myPromise();
console.log(foo)
console.log('fifth');
}
console.log('first')
second();
console.log('third');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment