917
I'll just sort it myself (sh.itjust.works)
you are viewing a single comment's thread
view the rest of the comments
[-] kevincox@lemmy.ml 5 points 1 year ago* (last edited 1 year ago)

No. It always compares by converting to string. I actually think this is more consistent then having different behaviour if you have a string somewhere in your list.

Basically the default comparator is a.sort((a, b) => `${a}` < `${b}` ? -1 : 1).

this post was submitted on 05 Sep 2023
917 points (98.7% liked)

Programmer Humor

19774 readers
15 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 2 years ago
MODERATORS