r/programminghorror
•
u/Leonnee
•
Jun 12 '25
•
1
Javascript Javascript is filled with horror
2.4k
Upvotes
View all comments
Show parent comment
1
u/LordFokas Jun 12 '25
I've been using JS for like... 17 years or so?
I think I had to sort arrays 3 or 4 times in all those years.
And when I did, I passed a comparator, except once because it was a string array.
It's not a big deal. The function is well implemented (pass a comparator to sort) it just has a default for convenience. When lexicographic is not convenient, you do what you'd have to do anyway if there wasn't a default, and pass the comparator you want.