@kuneho to Programmer [email protected] • edit-21 year agoJavaScript always know my truest of desiresimagemessage-square38arrow-up1395arrow-down16
arrow-up1389arrow-down1imageJavaScript always know my truest of desires@kuneho to Programmer [email protected] • edit-21 year agomessage-square38
minus-square@[email protected]linkfedilink18•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.Fuck JS is stupid.
Source: use JS regularly