How does js get the language of the current browser

Foreword:

        How does js get the language of the current browser.

Implementation:

const lang = navigator.language //zh-CN、en-US、zh-TW、zh

Achievable requirements:

        The default language in our project can be configured according to the current browser. For example, if it is the first time a user comes in, but his own browser is in English, we can configure the English version for him by default.

Guess you like

Origin blog.csdn.net/weixin_44727080/article/details/131849176