Home  >  Article  >  Web Front-end  >  调试代码导致IE出错的避免方法_javascript技巧

调试代码导致IE出错的避免方法_javascript技巧

WBOY
WBOYOriginal
2016-05-16 16:53:33887browse
复制代码 代码如下:

if(!window.console){
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml","group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

window.console = {};
for (var i = 0; i window.console[names[i]] = function() {};
}
}

可以放在基础库里面,当然,注意names和i的作用域~
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn