题库 软件开发 题目列表 设任务列表有三个异步的任务,即 `taskList = [taskA,...
单选题

设任务列表有三个异步的任务,即 `taskList = [taskA, taskB, taskC]`,想使用 `async/await` 配合 `forEach` 实现串行执行,以下哪个代码是可行的?

A.
async function run () {

taskList.forEach(async (task) => await task())

}

run()
B.
async function run () {

taskList.forEach((task) => await task())

}

run()
C.
function run () {

List.forEach(async (task) => await task())

}

run()
D.

其余都不对

题目信息
校招真题
-
正确率
0
评论
18
点击