极客时间返利平台,你可以在上边通过山月的链接购买课程,并添加我的微信 (shanyue94) 领取返现。
山月训练营之面试直通车 服务上线了,从准备简历、八股文准备、项目经历准备、面试、面经、面经解答、主观问题答复、谈薪再到入职的一条龙服务。

# 以下输出顺序多少 (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

欢迎在 Gtihub Issue 中回答此问题: Issue 396 (opens new window)

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

Last Updated: 11/27/2021, 6:11:48 PM