For use with sorting functions such as sortWith or
the built-in Array.prototype.sort(). Sorts in ascending
alphabetical order, ignoring all spaces and punctuation. For the
same letter, upper case letters come before lower case letters.
null follows all strings, with undefined at the very end.
For languages other than English, or for other conventions regarding punctuation,
letter case, etc., use alphaLocaleNullable.
Remarks
JavaScript's Array.prototype.sort() places undefined at the
end without even calling the comparator. This comparator, however,
still handles undefined so that it can be used with sort
implementations not based on Array.prototype.sort().
As of this writing (January 3, 2023), some Android browsers do not support this function..
For use with sorting functions such as sortWith or the built-in
Array.prototype.sort()
. Sorts in ascending alphabetical order, ignoring all spaces and punctuation. For the same letter, upper case letters come before lower case letters.null
follows all strings, withundefined
at the very end.For languages other than English, or for other conventions regarding punctuation, letter case, etc., use alphaLocaleNullable.
Remarks
JavaScript's
Array.prototype.sort()
placesundefined
at the end without even calling the comparator. This comparator, however, still handlesundefined
so that it can be used with sort implementations not based onArray.prototype.sort()
.As of this writing (January 3, 2023), some Android browsers do not support this function..
Example