共计 188 个字符,预计需要花费 1 分钟才能阅读完成。
function sleep(interval) {
return new Promise(resolve =>
setTimeout(() => resolve(interval), 1000)
);
}
async function stepPrint(n) {for (let i = 0; i <= n; i++) {console.log(i);
await sleep(i * 10000);
}
}
stepPrint(5);
正文完
发表至: javascript
2021-05-25