Last active
September 24, 2015 07:31
-
-
Save dhunmoon/2bbd7107223646897fe5 to your computer and use it in GitHub Desktop.
JS: alert function override
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
(function() { | |
var _alert = window.alert; // <-- Reference | |
window.alert = function(str) { | |
// do something additional | |
if(console) console.log(str); | |
//return _alert.apply(this, arguments); // <-- The universal method | |
// Suits for this case | |
}; | |
})(); | |
alert("This"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment