Created
December 8, 2011 14:08
-
-
Save codeimpossible/1447083 to your computer and use it in GitHub Desktop.
Brute force way to eliminate nasty alert() statements
This file contains hidden or 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
// 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