跳转到内容

报错:Uncaught ReferenceError: xxx is not defined解决方案

报错:Uncaught ReferenceError: xxx is not defined, 判断 xxx 的类型不等于undefined, 再去操作 下面以 window 为例

js
if (typeof window !== 'undefined') {
  console.log('window is defined');
}