SO Answer / Is there a way to clone native functions in javascript like window.alert or document.write

See: http://stackoverflow.com/questions/10266825/is-there-a-way-to-clone-native-functions-in-javascript-like-window-alert-or-docu

by KooiInc MeHere

JavaScript

var oldalert = window.alert;
window.alert= function alert(t){
    alert.count = !alert.count ? 1 : alert.count + 1;
    oldalert(t+' - That\'s alert nr '+alert.count);
};
alert('foo');
alert('bar');
alert('foobar');