Ways to avoid errors in IE caused by debugging code

  • 2020-03-30 02:35:11
  • OfStack

 
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 < names.length; i++){ 
window.console[names[i]] = function() {}; 
} 
} 

Can be placed in the base repository, of course, notice the scope of names and I ~

Related articles: