kuneho@lemmy.world to Programmer Humor@programming.dev · edit-21 year agoJavaScript always know my truest of desireslemmy.worldimagemessage-square37fedilinkarrow-up1434arrow-down16file-text
arrow-up1428arrow-down1imageJavaScript always know my truest of desireslemmy.worldkuneho@lemmy.world to Programmer Humor@programming.dev · edit-21 year agomessage-square37fedilinkfile-text
minus-squareheartlessevil@lemmy.onelinkfedilinkarrow-up2arrow-down6·1 year agoI don’t think JS works that way
minus-squareQuasari@programming.devlinkfedilinkarrow-up21·edit-21 year agoArray.prototype.sort if no callback is passed to it will coerce non-undefined elements to strings when sorting. It does do that. To sort numbers passing a function like (a, b) => a - b is good enough.
I don’t think JS works that way
It does.
Array.prototype.sort
if no callback is passed to it will coerce non-undefined
elements to strings when sorting. It does do that.To sort numbers passing a function like
(a, b) => a - b
is good enough.