Created
December 16, 2009 23:48
-
-
Save jasonwyatt/258352 to your computer and use it in GitHub Desktop.
Tiny javascript snippet/file to overwrite how alert usually works by forcing it to behave like console.log when possible.
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
/** | |
* Overwrites the old alert method and chooses to use console.log instead (if it's | |
* available). | |
* Author: Jason Feinstein | |
*/ | |
var oldAlert = alert; | |
alert = function(){ | |
if(window.console != null){ | |
console.log.apply(null, arguments); | |
} else { | |
oldAlert.apply(null, arguments); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment