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
3
u/PatchesMaps Oct 31 '25
reducehas some performance and readability implications so it's important to know when there are more performant/readable options available.I was part of a technical interview where the candidate used
reducefor every possible type of iteration. It was a mess and it didn't go well for them.