1async function async1 () { 2 await async2(); 3 console.log('async1'); 4 return 'async1 success' 5} 6async function async2 () { 7 return new Promise((resolve, reject) => { 8 console.log('async2') 9 reject('error') 10 }) 11} 12async1().then(res => console.log(res))
参考答案:
'async2'
Uncaught (in promise) error
最近更新时间:2022-01-09