站点工具

用户工具


趣味答题

这是一个关于Promise宏任务微任务的题目,猜猜以下代码输出是什么? 可以在 https://xiedaimala.com/bbs/topics/570#/ 晒自己的解题思路哦

let p1 = Promise.resolve()
  .then(v => console.log(1))
  .then(v => console.log(2))
  .then(v => console.log(3))
 
p1.then(v => console.log(4))
p1.then(v => console.log(5))
 
let p2 = Promise.resolve()
  .then(v => console.log(11))
  .then(v => console.log(22))
  .then(v => console.log(33))
 
p2.then(v => console.log(44))
p2.then(v => console.log(55))

最新文章

若愚 · 2021/12/23 22:52 · home.txt