Skip to content

Instantly share code, notes, and snippets.

@ernestohs
Created August 24, 2012 16:37
Show Gist options
  • Save ernestohs/3452674 to your computer and use it in GitHub Desktop.
Save ernestohs/3452674 to your computer and use it in GitHub Desktop.
Avoid JS errors if the console object doesn't exist
(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