if(typeof console !== "undefined"){
console.log("hello");
}
主要目的是兼容低版本IE,因为低版本原生ie(8及以下)window对象没有console,所以直接使用的话会导致脚本中断。
if(typeof console !== "undefined"){
console.log("hello");
}
主要目的是兼容低版本IE,因为低版本原生ie(8及以下)window对象没有console,所以直接使用的话会导致脚本中断。