The localeCompare() method is used to compare two strings in the current locale. It will return three values i.e, -1,1,0.