wonyun

前言

首先来看一个JavaScript的代码片段:

console.log(1);

setTimeout(() => {
  console.log(2);
  Promise.resolve().then(() => {
    console.log(3)
  });
}, 0);

new Promise((resolve, reject) => {
  console.log(4)
  resolve(5)
}).then((data) => {
  console.log(data);
})

setTimeout(() => {
  console.log(6);
}, 0)

console.log(7);

如果你能知道正确的答案,那么后续的内容可以略过了;如果不能建议看看下面有关js异步的内容,百利无一害,

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-05-21
  • 2021-06-23
  • 2018-09-04
  • 2022-02-23
  • 2021-07-17
  • 2021-11-25
  • 2021-07-23
猜你喜欢
  • 2022-02-05
  • 2021-08-02
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2021-07-19
相关资源
相似解决方案