@[email protected] to Programmer [email protected] • edit-22 years agoJavaScript always know my truest of desireslemmy.worldimagemessage-square38fedilinkarrow-up1434
arrow-up1427imageJavaScript always know my truest of desireslemmy.world@[email protected] to Programmer [email protected] • edit-22 years agomessage-square38fedilink
minus-square@[email protected]linkfedilink21•edit-22 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.
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