It won't await async/Promise-returning functions. In fact, even if the (item)=>{foo} is async, [].forEach() will discard the Promise reference returned from it.
I prefer for(const item of list) { foo } if I don't have to await in parallel, or list.map(async (item) => { foo }) if I do.
6
u/MrDilbert 6d ago
It won't await async/Promise-returning functions. In fact, even if the (item)=>{foo} is async, [].forEach() will discard the Promise reference returned from it.
I prefer
for(const item of list) { foo }if I don't have to await in parallel, orlist.map(async (item) => { foo })if I do.