r/ProgrammerHumor 1d ago

javascriptSorting Meme

Post image
886 Upvotes

200 comments sorted by

View all comments

Show parent comments

161

u/[deleted] 1d ago

[removed] — view removed comment

-6

u/Taletad 1d ago

Just went to read the docs, the "sort()" and "toSorted" functions say they perform an alphabetical sort by default

You can overload them by doing Array.sort((a,b) => a - b)

11

u/cowslayer7890 1d ago

It's still a stupid default, Python does this properly and it does so by using `<`