Prevent console.log throwing errors

by graham

Although all debugging code should be removed before live deployments there will likely be times during development that people without a debugging tool, like Firebug, will want to view the application.

To prevent console.log throwing an error add the following to your JavaScript:

 

if (typeof console === "undefined") {

       console = { log: function () { } };

}

 

 

Comments are closed