What is the purpose of the method localeCompare()?
A
If the reference string comes before or after another string
B
If the reference string is validated
C
If the string is a reference string
D
If the reference string comes first
Correct Answer: If the reference string comes before or after another string
The localeCompare() method compares two strings in the current locale. The locale is based on the language settings of the browser. The method localeCompare() returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.