Created
August 24, 2012 16:37
-
-
Save ernestohs/3452674 to your computer and use it in GitHub Desktop.
Avoid JS errors if the console object doesn't exist
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
(function () { | |
if (!window.console) { | |
console = {}; | |
} | |
console.log = console.log || function () { | |
}; | |
console.warn = console.warn || function () { | |
}; | |
console.error = console.error || function () { | |
}; | |
console.info = console.info || function () { | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment