Skip to content

Instantly share code, notes, and snippets.

@macgyver
Created December 29, 2011 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macgyver/1536442 to your computer and use it in GitHub Desktop.
Save macgyver/1536442 to your computer and use it in GitHub Desktop.
make console.log safe
// Ensure that no stray console.log calls break functionality by defining an
// empty console object and log function in browsers where they do not exist.
if (typeof console == "undefined" || typeof console.log == "undefined") {
var console = { log: function() {} };
window.console = { log: function() {} };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment