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)
})
看到一道题,我不是特别了解 js ,我大概看了下:
- 我感觉顺序应该是 413265
- 但是我实际跑了一下是 413625
为啥 6 在 2 前面呢?