Skip to content

Instantly share code, notes, and snippets.

@kmonsoor
Last active May 29, 2018
Embed
What would you like to do?
JavaScript -- Disable console.log & other in-browser console.* methods
"use strict";
(() => {
var console = (window.console = window.console || {});
[
"assert", "clear", "count", "debug", "dir", "dirxml",
"error", "exception", "group", "groupCollapsed", "groupEnd",
"info", "log", "markTimeline", "profile", "profileEnd", "table",
"time", "timeEnd", "timeStamp", "trace", "warn"
].forEach(method => {
console[method] = () => {};
});
console.log("This message shouldn't be visible in console log");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment