以下代码输出顺序是: setImmediate(() => { co...
发布于 2022-03-03 17:23:20
以下代码输出顺序是:
setImmediate(() => {
console.log(1)
Promise.resolve().then(() => {
console.log(2)
})
}, 0)
new Promise((resolve) => {
console.log(3)
resolve()
}).then(() => {
console.log(4)
process.nextTick(() => {
console.log(5)
})
setTimeout(() => {
console.log(6)
}, 0)
}).then(() => {
console.log(7)
})
console.log(8)
登录后免费查看答案
关注者
0
被浏览
28