Skip to content

Instantly share code, notes, and snippets.

Created Mar 21, 2019
What would you like to do?
Auto disable console.log() on production
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