/** * * @authors Benjamin(http://blog.csdn.net/cuew1987) */ (function (win){ //重置为空函数,避免JS报错 var console = win.console || {}, fns = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']; i = 0, fn = "", ilen = fns.length; for(; i < ilen; i++) { func = fns[i]; console[fn] = console[fn] || function(){}; } })(window);