Hi,
I have these two bits of code for sorting arrays.
The first one seems to not sort floats correctly.
which one is the correct way and why ?
thanks
array.sort(function(a, b)
{
if (a> b) return -1;
else if (a < b) return 1;
else return 0;
});
array.sort(function(a, b)
{
return b == a ? 0 : (b > a ? 1 : -1);
});