News for hackers. Stuff that matters.
Re:JavaScript Is Weird by mherrmann on Monday June 28, 2021 @08:27AM (#27660963)
JavaScript sorting numbers alphabetically is a fact I simply cannot get over. I know I should be pragmatic as an engineer but this goes against the core of my being. Awful.
Re:JavaScript Is Weird by epmatsw on Monday June 28, 2021 @08:32AM (#27661024)
Since it’s (imo) default-wrong in English, I’ve chosen to think of it as a nice way to point devs to something that’s locale-aware like Intl.Collator instead. If it “just worked” in English, most of us would never think to use the correct utility instead.
Re:JavaScript Is Weird by mokus on Monday June 28, 2021 @11:14AM (#27662993)
This is a bit of a tangent, but that makes me wonder… are there any languages where this particular collation would be correct?
Re:JavaScript Is Weird by jonny_eh on Monday June 28, 2021 @06:01PM (#27668791)
It also alters the original array, just awful usability.