📜  forloop 中的 promise - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:28.098000             🧑  作者: Mango

代码示例1
(async function loop() {
    for (let i = 0; i < 10; i++) {
        await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
        console.log(i);
    }
})();