title: Is there a way to clone native functions in javascript like window.alert or document.write
body: <p>What I want to do is change every alert in the code to a custom alert("you used alert");</p>
  
  <pre><code>var hardCodedAlert = alert; //I know this won't work.But what to do ?
  window.alert=function(){
  if(this.count == undefined)
  this.count=0;
  this.count=this.count+1;
  if(this.count == 1)
  hardCodedAlert("You used alert");
  };
  </code></pre>