Creates a Comparator that orders string values by their natural order, i.e. 'a' < 'aa' < 'ab'.
string
'a' < 'aa' < 'ab'
Sort an Array of string values
const array = ["ba", "aa", "ab"];array.sort(stringComparator());console.log(array); // ["aa", "ab", "ba"]
a Comparator for string values
Rest
the arguments passed to String.prototype.localeCompare
Generated using TypeDoc
Creates a Comparator that orders
stringvalues by their natural order, i.e.'a' < 'aa' < 'ab'.Example
Sort an Array of string values
Returns
a Comparator for string values