js get default language for location code example
Example 1: javascript get user preferred language
//detect the language preference of the user's browser
var userLanguage = window.navigator.userLanguage || window.navigator.language;
Example 2: check browser locale javascript
check locale using js