Example 1 — Read the Preference List
Log navigator.language and navigator.languages together (MDN listing style).
console.log(navigator.language);
console.log(navigator.languages);
console.log("count: " + navigator.languages.length); How It Works
- Read one tag.
navigator.languageis the top preference as a string. - Read the array.
navigator.languageslists preferences in order. - Check length. Useful when you only care whether more than one locale exists.
- Expect variation. Tags and list length differ by browser and privacy mode.

