前端 每日一题 9月7日

问题:输出以下代码执行结果

function wait() {
  return new Promise(resolve =>
   setTimeout(resolve, 10 * 1000)
  )
}


async function main() {
  console.time();
  const x = wait();
  const y = wait();
  const z = wait();
  await x;  await y;
  await z;
  console.timeEnd();
}
main();

-------------------------------------

猜你喜欢

转载自blog.csdn.net/weixin_44180173/article/details/108440776