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 comments

-4

u/StoneCypher Oct 31 '25

ok.  if it isn’t just writing sort in the comparator, then please trivial me.

8

u/the-liquidian Oct 31 '25

-10

u/StoneCypher Oct 31 '25

if it isn’t just writing sort in the comparator

7

u/the-liquidian Oct 31 '25

This is using reduce with a trivial implementation of an insertion sort.

-7

u/StoneCypher Oct 31 '25

ok, just ignore the criteria i set, then

have a good day

→ More replies (0)