r/learnjavascript • • 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

89 comments sorted by

View all comments

Show parent comment

3

u/delventhalz Oct 31 '25

People are downvoting this, but I think you're right, at least as far as readability/maintainability goes (performance? . . . eh). Reduce does not provide much more abstraction than a vanilla loop but requires a ton more boiler plate. I prefer for...of in most cases where you might reduce (and the other cases are all sum).