You can detect the browser’s preferred language using navigator.language
or navigator.languages
.
Example:
console.log(navigator.language); // 'en-US'
Tags: basic, JavaScript, browser features
URL: https://www.tiktok.com/@jsmentoring/photo/7459014680225303841