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/

Blogbook : PHP | Javascript | Laravel | VueJs | Python | TensorFlow