-
-
Save zhenghaohe/c90ec960b890eca60b7bd8008f856a70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function async1(){ | |
await async2() | |
console.log('1') | |
} | |
async function async2(){} | |
async1(); | |
new Promise(function(resolve){ | |
resolve(); | |
}).then(function(){ | |
console.log('2') | |
}).then(function() { | |
console.log('3') | |
}).then(function() { | |
console.log('4') | |
}) | |
// <> | |
async function async1() { | |
Promise.resolve(async2()).then(() => { | |
console.log('1') | |
}) | |
} | |
async function async2(){} | |
async1(); | |
new Promise(function(resolve){ | |
resolve(); | |
}).then(function(){ | |
console.log('2') | |
}).then(function() { | |
console.log('3') | |
}).then(function() { | |
console.log('4') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment