I am looking to replace all instances of the alert function in my code with a custom alert message saying "you used alert".
var hardCodedAlert = alert; //Although I understand this won't work. What other approach can I take?
window.alert=function(){
if(this.count == undefined)
this.count=0;
this.count=this.count+1;
if(this.count == 1)
hardCodedAlert("You used alert");
};