nenadmarkus / picojs

A face detection library in 200 lines of JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Javascript sort misuse

ozomer opened this issue · comments

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)