await undefined有什么用?

const sumAsync = async (list) => {
    await undefined;
    if (list.length === 1) return list[0];
    const prev = list.pop();
    return prev + (await sumAsync(list));
};

加了不加一样啊?

阅读 2.1k
1 个回答

单纯看是没什么意义的。可能仅仅是为了将计算延迟到微任务中而做的。

推荐问题