alphacyberranger to Programmer Humor@programming.dev · 1 year agoI'll just sort it myselfimagemessage-square48fedilinkarrow-up1938arrow-down112
arrow-up1926arrow-down1imageI'll just sort it myselfalphacyberranger to Programmer Humor@programming.dev · 1 year agomessage-square48fedilink
minus-squarekevincox@lemmy.mllinkfedilinkarrow-up5·edit-21 year agoNo. 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).
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)
.