Prevent IE crash console.log

origin
  When the console is close and we call console.log from javascript most of the times Internet Explorer will crash with the message:  Error:'console' is undefined

if (typeof console == 'undefined')   {
    var console = new Object();
    console.log = function(){}
    console.error = function(){}
    console.debug = function(){}
    console.warn = function(){}
}

你可能感兴趣的:(JavaScript,IE,console.log)