console.log 报错 uncaught typeerror illegal invocation
因为ie不支持console.log的原因 封装了一层 代码如下
function debug(){
window.console && console.log.apply(null , arguments);
}
FF下正常 chrome下把错uncaught typeerror illegal invocation
原因是console.log的运行上下文要求是console不能是其它任何别的object
console.info.call(this,"stuff")
TypeError:Illegal invocation
console.info.call(console,"stuff")
stuff
修改代码为
window.console && console.log.apply(console , arguments);