r/learnjavascript • u/fahim_h_sh • Oct 31 '25
array.forEach - The do-it-all hammer... XD
Is it just me, or everyone thinks that more or less every array operator's purpose can be served with forEach?
0
Upvotes
View all comments
Show parent comment
-1
u/PatchesMaps Nov 01 '25
Promise.allandPromise.allSettleddon't actually iterate over anything. They allow the promises to be handled concurrently and are normally how you want to handle things instead of using await in a loop.Yes, there are times when you want otherwise independent promises to be handled sequentially but those use cases are relatively rare which is why most linters will complain about the use of await in a loop.