[FE] JS 判断当前是否在微信浏览器中的最新代码

注意以下使用了 const 定义未改变的变量,没有使用 var。

function isWeChatBrowser () {
  const ua = window.navigator.userAgent.toLowerCase()
  const matchArr = ua.match(/MicroMessenger/i)
  return matchArr && (matchArr.toString() === 'micromessenger')
}

Link:https://www.cnblogs.com/farwish/p/13082487.html

原文地址:https://www.cnblogs.com/farwish/p/13082487.html