Created
June 14, 2011 15:07
-
-
Save tofumatt/1025079 to your computer and use it in GitHub Desktop.
Console.log
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
// Try to use console.log(). If it's undefined, define an | |
// empty object/static method to allow console.log() use | |
// throughout the app without breaking anything. | |
try { | |
console.log("Testing console.log()"); | |
} catch (e) { | |
// Prevent errors arising from use of console.log() | |
console = { | |
log: function(a, b) { | |
// Don't do anything, just define this so we can | |
// use console.log() without worrying about undefined | |
// when the console log isn't open. | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment