zl程序教程

您现在的位置是:首页 >  前端

当前栏目

await 只能在 async 中使用吗? 并不是

async 不是 只能 await 使用
2023-09-11 14:17:02 时间
for await (let a of [1,2,3]) {
  console.log(a)
}

 

node 环境里必须在 async 函数中, 浏览器控制台中不需要。