Skip to content

Instantly share code, notes, and snippets.

@r38y
Last active August 15, 2016 08:36
Show Gist options
  • Save r38y/6312262 to your computer and use it in GitHub Desktop.
Save r38y/6312262 to your computer and use it in GitHub Desktop.
Make console.log bulletproof.
// see if the browser supports console.log - fail gracefully if it doesn't
try {
console.log();
console.debug();
console.assert();
} catch(e) {
console = {
log: function() {},
debug: function() {},
assert: function() {}
}
}
try
console.assert(1)
catch error
console =
log: -> {}
assert: ->
debug: ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment