Javascript sort misuse
ozomer opened this issue · comments
Oren Zomer commented
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)