r/programminghorror • • Jun 12 '25 • This 1

Javascript Javascript is filled with horror

Post image
2.4k Upvotes

337 comments sorted by

View all comments

Show parent comment

23

u/mediocrobot Jun 12 '25

Sorting untyped arrays is still a wiiiild use case. I know the philosophy behind JS at the time was minimizing exception handling by pretending everything's okay, but this is still kinda ridiculous.

3

u/rover_G Jun 12 '25

Not only the coercion better than error philosophy but also not using class based object oriented principles where each class object knows how to compare itself to another class object

11

u/mediocrobot Jun 12 '25

I guess each object knows how it can turn into a string, and each string knows how to compare to another string, so that's kind of what happens.

1

u/Redingold Jun 12 '25

It saddens me greatly that the proposals for operator overloading in Javascript have been soundly rejected.