Created
December 29, 2011 22:15
-
-
Save macgyver/1536442 to your computer and use it in GitHub Desktop.
make console.log safe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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