Created
March 21, 2019 19:09
-
-
Save J2TEAM/79aea6a7e61c002e0b3e73879994dce1 to your computer and use it in GitHub Desktop.
Auto disable console.log() on production
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEBUG = false; | |
if (!DEBUG) { | |
if (!window.console) window.console = {}; | |
let methods = ['log', 'debug', 'warn', 'info']; | |
for (let i = 0; i < methods.length; i++) { | |
console[methods[i]] = function() {}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment