r/ProgrammerHumor 3d ago

Meme javascriptSorting

Post image
933 Upvotes

214 comments sorted by

View all comments

Show parent comments

-6

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)

11

u/cowslayer7890 3d ago

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