# 以下输出顺序多少 (setTimeout 与 promise 顺序)

更多描述

setTimeout(() => console.log(0))
new Promise((resolve) => {
 console.log(1)
 resolve(2)
 console.log(3)
}).then(o => console.log(o))

new Promise(resolve => {
 console.log(4)
 resolve(5)
}).then(o => console.log(o)).then(() => console.log(6))

Issue

欢迎在 Issue 中交流与讨论: Issue 396 (opens new window)

1 => 3 => 4 => 2 => 5 => 6 => 0

Last Updated: 1/17/2021, 2:02:56 PM