localeCompare() method returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
|compareString||Required||The string to compare with.|
|-1||If a string neither starts with nor equal to compareString.|
i.e., "cdab" = "ab"
|0||If both strings are equal|
i.e., "ab" = "ab"
|1||If a string starts with compareString.|
i.e., "abcd" = "ab".
If both strings are equal, but are case sensitive.
i.e., "AB" = "ab".
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.