~~~ async function async1() { console.log('async1 start'); await async2(); console.log('async1 end'); } async function async2() { console.log('async2'); } console.log('script start'); setTimeout(function() { console.log('setTimeout'); }, 0); async1(); new Promise(function(resolve) { console.log('promise1'); resolve(); }).then(function() { console.log('promise2'); }); console.log('script end'); ~~~ 出了点小问题,没做过await相关的,都是Promise.then,之类的同步写法 ~~~ script start async1 start async2 // 正确的 promise1 script end async1 end promise2 setTimeout // 我把awiat 语句包括下面那行当成微任务处理了,所以我面试的时候说的是 script start async1 start promise1 script end async2 // 错误的 async1 end promise2 setTimeout ~~~