Skip to content

Instantly share code, notes, and snippets.

@ghooghe
Created June 11, 2013 09:33
Show Gist options
  • Select an option

  • Save ghooghe/5755644 to your computer and use it in GitHub Desktop.

Select an option

Save ghooghe/5755644 to your computer and use it in GitHub Desktop.
console.debug declaration to avoid javascript error problems
// Console declaration if not defined
if (typeof console === 'undefined' || typeof console.debug === 'undefined') {
console = {};
console.debug = function() {};
}
@atrindade77
Copy link

There is a problem on this code: if console is not undefined and console.debug is undefined, so we will enter inside your if clause. But you do console = {} on line 3, so if console is not undefined, you will override de entire console object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment