Re:Unravelling `Async for` Loops
by jimmydief on Wednesday September 15, 2021 @12:04AM
(#28535154)
A little more verbose than your example but https://github.com/tc39/proposal-async-do-expressions would help with this.
[ Parent
| on HN ]
Thanks! I think it wouldn’t await the whole loop though
for (const item of iterable)
async do {
await item()
}
This would be equivalent to Promise.all(arr.map(async item => {
await item()
})
Notice the lack of await before Promise.all