How to sort a javascript array of numbers
Usually works for me:
a.sort(function(a,b){
return a - b;
});
So if you write the sorting function, it will work.
[1, 23, 100, 3].sort(function(a, b){
if (a > b)
return 1;
if (a < b)
return -1;
return 0
});