Skip to content

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

Posted on:2022年1月9日 at 23:23
async function async1() {
  await async2();
  console.log("async1");
  return "async1 success";
}
async function async2() {
  return new Promise((resolve, reject) => {
    console.log("async2");
    reject("error");
  });
}
async1().then((res) => console.log(res));

'async2'
Uncaught (in promise) error
原文转自:https://fe.ecool.fun/topic/32b06302-58e6-44df-acb7-6c975dcc2957