async function async1 () { console.log('async1 start'); await new Promise(resolve => { console.log('promise1') }) console.log('async1 success'); return 'async1 end' } console.log('srcipt start') async1().then(res => console.log(res)) console.log('srcipt end')

参考答案

解析

async1中await后面的Promise是没有返回值的,也就是它的状态始终是pending状态,因此相当于一直在await,await,await却始终没有响应...

所以在await之后的内容是不会执行的,也包括async1后面的 .then。

结果

'script start'
'async1 start'
'promise1'
'script end'