-
-
Save gentlefox/9755686 to your computer and use it in GitHub Desktop.
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
// This is not some kind of polyfill! It's just to prevent old browsers from failing horribly | |
var fallback = function() {}; | |
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn', 'table']; | |
if(typeof console === 'undefined') { | |
var console = {}; | |
} | |
for(var i in methods) { | |
if(typeof console[methods[i]] === 'undefined') { | |
console[methods[i]] = fallback; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment