kuneho@lemmy.world to Programmer Humor@programming.dev · edit-22年前JavaScript always know my truest of desireslemmy.worldimagemessage-square37fedilinkarrow-up1437file-text
arrow-up1437imageJavaScript always know my truest of desireslemmy.worldkuneho@lemmy.world to Programmer Humor@programming.dev · edit-22年前message-square37fedilinkfile-text
minus-squareQuasari@programming.devcakelinkfedilinkarrow-up21·edit-22年前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.
minus-squarestratoscaster@lemmy.ziplinkfedilinkarrow-up17·2年前Fuck JS is stupid. Source: use JS regularly
deleted by creator
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.Fuck JS is stupid.
Source: use JS regularly