
有点懵逼
async function test () { await new Promise((res, rej) => { setTimeout(() => { console.log('time on') }, 2000) }) } async function main () { await test() console.log('test done') //卧槽,竟然不执行这一行 } main() console.log('main don')
图片暴露隐私,重新编辑了
1 feibinyang 2020-05-08 15:04:20 +08:00 没有 resolve 掉当然不执行啊,Promise 一直在 pending 状态 |
2 TomVista OP @feibinyang 明白了 |