The comparer function should return a negative number, positive number, or zero (which is a convention across programming languages).
myArray.sort(function(a, b) {
return a-b;
});
Full description is here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description