kuneho@lemmy.world to Programmer Humor · edit-22 years agoJavaScript always know my truest of desireslemmy.worldimagemessage-square35linkfedilinkarrow-up1445arrow-down16file-text
arrow-up1439arrow-down1imageJavaScript always know my truest of desireslemmy.worldkuneho@lemmy.world to Programmer Humor · edit-22 years agomessage-square35linkfedilinkfile-text
minus-squareQuasarilinkfedilinkarrow-up21·2 years 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-up17arrow-down1·2 years agoFuck JS is stupid. Source: use JS regularly
Array.prototype.sortif no callback is passed to it will coerce non-undefinedelements to strings when sorting. It does do that.To sort numbers passing a function like
(a, b) => a - bis good enough.Fuck JS is stupid.
Source: use JS regularly