Is there any way to turn off all console.log
statements in my JavaScript code, for testing purposes?
I am surprised that of all those answers no one combines:
I'd go for this:
(function () {
var debug = false
if (debug === false) {
if ( typeof(window.console) === 'undefined') { window.console = {}; }
window.console.log = function () {};
}
})()