async await
2022年5月1日小于 1 分钟
async await
Question
What does the code snippet to the right output by console.log
?
Snippet
async function async1(){
console.log(1)
await async2()
console.log(2)
}
async function async2(){
console.log(3)
}
console.log(4)
setTimeout(function(){
console.log(5)
}, 0)
async1()
new Promise(function(resolve){
console.log(6)
resolve()
}).then(function(){
console.log(7)
})
console.log(8)