kuneho@lemmy.world to Programmer Humor@programming.dev · edit-21 year agoJavaScript always know my truest of desireslemmy.worldimagemessage-square23fedilinkarrow-up147arrow-down10file-text
arrow-up147arrow-down1imageJavaScript always know my truest of desireslemmy.worldkuneho@lemmy.world to Programmer Humor@programming.dev · edit-21 year agomessage-square23fedilinkfile-text
minus-squareQuasari@programming.devlinkfedilinkarrow-up1·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.
minus-squarestratoscaster@lemmy.ziplinkfedilinkarrow-up2·1 year agoFuck JS is stupid. Source: use JS regularly
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