Sometimes you might want to disable console.log in JavaScript, because, say, you have a library performing excessive logging, or for any other reason. This is how you can do it:

console.log = function () {};

In case you want to preserve the console.log functionality under a different function, you can do it like this:

consoleLog = console.log;
console.log = function () {};