Run ❯
Get your
own
website
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
JavaScript Strings
The localeCompare() Method
localeCompare() returns one of 3 numbers indicating the sort order.
-1 if sorted before
1 if sorted after
0 if equal
Compare "cd" with "ab":