Skip to content

Instantly share code, notes, and snippets.

@YSMull
Created November 17, 2018 03:33
Show Gist options
  • Save YSMull/45bf84caeb8721523d4adf28b2449a97 to your computer and use it in GitHub Desktop.
Save YSMull/45bf84caeb8721523d4adf28b2449a97 to your computer and use it in GitHub Desktop.
async function fn1() {
console.log(1);
await new Promise((resolve, reject) => {
console.log(2);
resolve();
})
console.log(3);
};
fn1();
console.log(4)
console.log(5)
console.log(1)
new Promise(function (resolve, reject) {
resolve(new Promise((resolve, reject) => {
console.log(2);
resolve();
}))
}).then(() => {
console.log(3);
})
console.log(4)
console.log(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment