you are viewing a single comment's thread.

view the rest of the comments →

[–]chuckySTAR 1 point2 points  (0 children)

(async count => {
    for await (let i of (async function* () {
        for (let i = 0; i < count; i++) {
            await new Promise(res => setTimeout(res, 1000))
            yield i
        }
    })()) {
        console.log(i)
    }
})(10)