Skip to content

Instantly share code, notes, and snippets.

@zhenghaohe
Created August 13, 2022 06:14
Show Gist options
  • Save zhenghaohe/c90ec960b890eca60b7bd8008f856a70 to your computer and use it in GitHub Desktop.
Save zhenghaohe/c90ec960b890eca60b7bd8008f856a70 to your computer and use it in GitHub Desktop.
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