417
submitted 1 year ago* (last edited 1 year ago) by kuneho@lemmy.world to c/programmer_humor@programming.dev

you are viewing a single comment's thread
view the rest of the comments
[-] fuck_u_spez@lemmy.fmhy.ml 7 points 1 year ago

I couldn't believe it, tried it out, what the actual heck? I mean I get all these weird string vs number comparison but sorting actual numbers and this comes out? What kind of drugs were the designers of javascript (or at least this function) on... Who thought it was a good idea to sort numbers lexicographically??

[-] valourvalkyria@lemmy.world 1 points 1 year ago

Iirc Array.sort requires you to pass a function in, or it casts into strings and sort them.

load more comments (3 replies)
this post was submitted on 07 Jul 2023
417 points (98.6% liked)

Programmer Humor

19522 readers
325 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