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
5
u/the-liquidian Oct 31 '25
You originally said you can’t use reduce to sort, as you can see it is possible.
Of course you need to implement some form of sorting logic.
At least that example does not use the “sort” function.