Skip to content

【Promise第37题】下面代码的输出是什么?

Posted on:2022年1月9日 at 23:24
async function async1() {
  try {
    await Promise.reject("error!!!");
  } catch (e) {
    console.log(e);
  }
  console.log("async1");
  return Promise.resolve("async1 success");
}
async1().then((res) => console.log(res));
console.log("script start");

'script start'
'error!!!'
'async1'
'async1 success'

原文转自:https://fe.ecool.fun/topic/59b71384-0a0a-4d2e-a63a-f4fb75650b60