Skip to content

Instantly share code, notes, and snippets.

@JordanReiter
Created September 28, 2012 18:57
Show Gist options
  • Save JordanReiter/3801535 to your computer and use it in GitHub Desktop.
Save JordanReiter/3801535 to your computer and use it in GitHub Desktop.
Simple console polyfill -- does nothing if console is not defined.
window.console = window.console || (function() {
var empty = function () {},
functions = "log info warn error assert dir clear profile profileEnd".split(" "),
ff = 0,
fun = null,
return_obj = {};
for(ff = 0; fun = functions[ff]; ff += 1) {
return_obj[fun] = empty
}
return return_obj
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment