asyncPrint(1000).catch(err => {console.log(err); // 從這裏捕捉到錯誤})複製代碼
async function exc1 () {console.log('exc1 start:',Date.now())let res1 = await test1();let res2 = await test2(); // 不依賴 res1 的值console.log('exc1 end:', Date.now())}複製代碼
let [res1, res2] = await Promise.all([test1(), test2()])複製代碼