昨天百度新闻的同事让我帮忙排查一下线上问题,最终问题定位到这样一段代码:
if (window.varname === undefined) {
...
}
左侧是Chrome,右侧是Firefox
所以不要写这样的代码
if (window.xxxxxx === undefined) {...}
要写成
if (typeof window.xxxxx === "undefined" ) {....}
昨天百度新闻的同事让我帮忙排查一下线上问题,最终问题定位到这样一段代码:
if (window.varname === undefined) {
...
}
左侧是Chrome,右侧是Firefox
所以不要写这样的代码
if (window.xxxxxx === undefined) {...}
要写成
if (typeof window.xxxxx === "undefined" ) {....}