这段代码的执行结果为:
- 输出 "promise"
- 调用 func1,输出 "func1"
- 设置了一个 setTimeout 函数,在一段时间后,输出 "setTimeout"
- Promise 的 resolve 函数被调用,传入值为 5,输出 "then回调 5"
注意:setTimeout 是异步执行的,所以不能确定它具体在什么时候输出,但是它一定是在 func1 之后执行。
这段代码的执行结果为:
注意:setTimeout 是异步执行的,所以不能确定它具体在什么时候输出,但是它一定是在 func1 之后执行。