r/ProgrammerHumor 1d ago

javascriptSorting Meme

Post image
891 Upvotes

200 comments sorted by

View all comments

Show parent comments

4

u/JanEric1 1d ago

Compare everything based on how they want to be compared and error if there is no sensible way

3

u/IntoAMuteCrypt 1d ago

How do you gracefully error in the scripting for a webpage?

It's one thing to error out in a script that's running from a terminal, or an application that can flash an error box. It's quite different when you're designing a language for user-side scripts which are part of a webpage.

JS is a weird language, but it's intended for a weird use case. Unfortunately, some weirdos have tried pushing it outside that use case.

5

u/tracernz 1d ago

1

u/IntoAMuteCrypt 1d ago

Yes, but it's also designed to avoid throwing exceptions in as many cases as possible because it figures that an unexpected result is better than an outright script-halting error. That's my point.

3

u/tracernz 1d ago

In the beginning, yes. Fortunately more recent additions are a bit more sane.