The second style (for ... of) is for awaiting inside, or for await ... of.
The third style, I generally use map because of performance, but grammatically, it would be for each. Also, map(async () => ...) can be used with Promise.all (or Promise.allSettled).
Learn something new every day.
- I am a senior software engineer working in industry, teaching and writing on software design, SOLID principles, DDD and TDD.
Location
Buenos Aires
Education
Computer Science Degree at Universidad de Buenos Aires
I also prefer to hide explicit iteration. Still, I had to use the first style for chunking.
The second style (
for ... of
) is for awaiting inside, orfor await ... of
.The third style, I generally use
map
because of performance, but grammatically, it would be for each. Also,map(async () => ...)
can be used withPromise.all
(orPromise.allSettled
).In my opinion chinking should be hidden at iteration level.
That is, if a convenient library function exists.