I assume you’re using Chrome? The example given (using a < b
to sort in reverse alphabetical order) is not correct afaics.
Removing the callback should sort in the correct order by default: it sorts by character code points, and a comes before b, b comes before c, etc.
But for the callback, it should return -1 (or a negative number), 0, or 1 (or a positive number). So b - a
, not a > b
(which returns true or false instead)