Collator : Object
Collator provides language aware comparison of Strings for sorting and searching. Available through Intl.Collator.
Constructors
Instance Methods
Compares two string values to determine which should come first if they were sorted alphabetically according to the locales of the Collator. Returns 0
if value1
is the same as value2
, a negative value if value1
should come before value2
, and a positive value if value1
should come after value2
. Can be passed to Array.sort() to sort a list of strings.
Example:
RunResults:
Copyright © JavaScripture Contributors