异步、Promise 与事件循环

通过受控的时间例子解释异步执行顺序,实现串行与并行任务,并处理失败与提前结束。

前端基础核心约 35 分钟
开始学习
学习目标
  • 解释事件循环的执行顺序:同步代码、微任务、宏任务
  • 用 async/await 写串行任务,用 Promise.all 写并行任务并说明耗时差异
  • 用 allSettled 处理部分失败,用 Promise.race 实现超时提前结束

Command Palette

Search for a command to run...