My difficulty here could be my mathematical illiteracy, but I was trying to sort some numbers in a JavaScript array and this is the solution I found online. It does indeed w
See the specification, http://www.ecma-international.org/ecma-262/5.1/#sec-15.5.4.14
Don't rely on things that w3schools has to say.
If comparefn is not undefined, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y.