记录一下
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() {}; } }
可以放在基础库里面,当然,注意names和i的作用域~
原文:http://www.cnblogs.com/season-huang/p/3632270.html