js get browser language 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: react chrome get language
<script type="text/javascript">
var userLang = navigator.language || navigator.userLanguage;
alert ("The language is: " + userLang);
</script>