Cross browser safe javascript console.log


 

if (typeof console === “undefined”){
 console={};
 console.log = function(){
 return;
 }
 }

-In JQuery you can define a custom function, and use that instead of console.log().

$.logger = function(logvar){
    if ((window['console'] !== undefined)) {
      console.log(logvar);
    };
  }
Usage :
$.logger(var);
or
$.logger('This is a message');

 

 

http://tothildiko.com/console-log-cause-error-in-internet-explore/

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress