【Promise第23题】
参考答案
结论
同步代码全部先执行完,然后才轮到任何 then 回调。
const p = Promise.resolve(1);
p.then(v => console.log('then', v)); // 微任务
console.log('sync'); // 先输出
// sync → then 1
即使 Promise 已 fulfilled,then 回调也不会同步执行——这是 Promise/A+ 规范的硬性要求。