Posted By

bitsculptor on 05/24/13


Tagged

ie console log bugs consolelog


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

martypowell
Priestd09


Safe console.log usage in all browsers


 / Published in: JavaScript
 

IE doesn't like console.log. This fixes that.

  1. // make it safe to use console.log always
  2. (function(a){function b(){}for(var c="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d;!!(d=c.pop());){a[d]=a[d]||b;}})
  3. (function(){try{console.log();return window.console;}catch(a){return (window.console={});}}());

Report this snippet  

You need to login to post a comment.