if you want to sort chars or strings then you don’t need to pass a function to the sort() method, because the role of this method is to sort strings and if we want to sort number we pass a function to bypass this issue because .
By default, the sort() function sorts values as strings .
The function passed to sort has to return one of three values (-1, 0, or 1), not true/false (check the examples in the documentation @ILM posted).
This has been gone over a lot on the forums (the example using > stopped working in Chrome in a out October), and there is a fix in place but it hasn’t gone live as far as I know.
Also, may help (do search the forums though, there are a lot of threads on this issue and a lot of good answers which explain what sort does, how it works etc)