Suppose I want to include some calls to console.log for some legitimate production reason, say for something like a unit test harness. Obviously I would not want th
console.log
As a slight variation on Chris' answer, simply define 'log' as a property of 'console' with an empty function:
if (typeof console === "undefined") { console = { log: function () { return; } }; }