Skip to content

Instantly share code, notes, and snippets.

@codeimpossible
Created December 8, 2011 14:08
Show Gist options
  • Save codeimpossible/1447083 to your computer and use it in GitHub Desktop.
Save codeimpossible/1447083 to your computer and use it in GitHub Desktop.
Brute force way to eliminate nasty alert() statements
// brute force
// this actually turns out to be better than alert()
// as it will stop stupid "[Object object]" alerts
// and instead log the actual object to the console
// the console && console.log check is to make sure
// this code doesn't fail in IE which does not create
// the console obj unless the user has dev tools open.
window.alert = function(m) {
if(console && console.log) {
console.log(m);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment