title: limit function to run after spesifict time
body: <pre><code>var change= document.getElementById("change");
  var color= document.getElementById("color");
  var result=document.getElementById("result");
  
  function changecolor(){
      change.addEventListener("click",randomColor());
  }
  function randomColor(){
    for(var i=0; i&lt;1000; i++){
      var randomColor ='#'+Math.random().toString(16).substr(2,6);
      color.style.background=randomColor;
      result.innerHTML="current color is"+randomColor;
    }
  }
  </code></pre>
  
  <p><a href="https://jsfiddle.net/z9yu3tjm/" rel="nofollow noreferrer">https://jsfiddle.net/z9yu3tjm/</a></p>
  
  <p>i have function like that to generate random color. each click will genereate random color. i want to show an alert if the function run 5 times. and the function will stop (cant be click). how to do that</p>