You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Classic "javascript gotcha". The default sort compares the string values, not number values. [1, 10, 2].sort() will result in [1,10,2].
I'm almost sure this was not the purpose...
Please use sort((a,b) => a-b)
The text was updated successfully, but these errors were encountered:
ozomer
changed the title
Javascript sort misusage
Javascript sort misuse
Aug 23, 2019
https://github.com/tehnokv/picojs/blob/master/lploc.js#L110-L111
Classic "javascript gotcha". The default sort compares the string values, not number values.
[1, 10, 2].sort()
will result in[1,10,2]
.I'm almost sure this was not the purpose...
Please use
sort((a,b) => a-b)
The text was updated successfully, but these errors were encountered: