Is there a way to sort an array using Chrome?
Using the sort function does not work as seen in this example:
var myArray = [1,4,5,3,2];
myArray.sort ( function( a , b ){
return b>a
});
for ( var i = 0; i < myArray.length; i++ )
{
document.write( myArray[i] )
}
Firefox / IE / Opera / Safri output: 54321
Chrome output: 53241
Thanks for your time!
The comparer function should return a negative number, positive number, or zero (which is a convention across programming languages).
Full description is here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description