this post was submitted on 07 Jul 2023
426 points (98.6% liked)

Programmer Humor

19488 readers
904 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 8 points 1 year ago (1 children)

It's just sorted alphabetically (technically it is the UTF16 code order). To be fair it's a sane default for most use cases. In JS case you can define a very simple callback to change the behavior to numeric sorting (a,b => a<b). Many other sorters provide a flag instead, but numeric sorting is seldom the default as it is not as useful most of the time in weakly typed languages.

[โ€“] [email protected] 2 points 1 year ago

weakly typed languages

Well, looks like we found the problem right there