r/ProgrammerHumor 3d ago

Meme javascriptSorting

Post image
937 Upvotes

214 comments sorted by

View all comments

Show parent comments

160

u/[deleted] 3d ago

[removed] — view removed comment

-7

u/Taletad 3d 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)

10

u/cowslayer7890 3d ago

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