References

String.localeCompare()

Leírás

Összehasonlítás, eredménye -1, 0, 1.

Szintaxis

localeCompare(compareString)
localeCompare(compareString, locales)
localeCompare(compareString, locales, options)

Példa

const text1 = 'red apple'
const text2 = 'red'
 
console.log(text1.localeCompare('red pear'))
// Expected output: -1
 
console.log(text2.localeCompare('red'))
// Expected output: 0
in this article
back to top