title: How do you stop or disable a button after I have clicked it (setInterval)?
body: <p>I made a count down timer and the start button starts the count with a setInterval. My problem is that if a user accidently clicks on the start button again, it starts another interval and speeds up the count down.</p>
  <pre><code>const timeH = document.querySelector(&quot;h1&quot;);
  
  let timeSecond = prompt(&quot;Enter minutes here&quot;) * 60;
  
  displayTime(timeSecond);
  
  function displayTime(second) {
    const min = Math.floor(second / 60);
    const sec = Math.floor(second % 60);
    timeH.innerHTML = `${min &lt; 10 ? &quot;0&quot; : &quot;&quot;}${min}:${sec &lt; 10 ? &quot;0&quot; : &quot;&quot;}${sec}`;
  }
  
  function endTime() {
    timeH.innerHTML = &quot;TIME OUT&quot;;
  }
  
  function countDown() {
    timeSecond--;
    displayTime(timeSecond);
  
    if (timeSecond &lt;= 0 || timeSecond &lt; 1) {
      endTime();
    }
  }
  
  document.querySelector(&quot;.start&quot;).addEventListener(&quot;click&quot;, () =&gt; {
    count = setInterval(countDown, 1000);
  });
  
  document.querySelector(&quot;.stop&quot;).addEventListener(&quot;click&quot;, () =&gt; {
    clearInterval(count);
  });
  
  document.querySelector(&quot;.reset&quot;).addEventListener(&quot;click&quot;, () =&gt; {
    clearInterval(count);
    timeSecond = prompt(&quot;Enter minutes here&quot;) * 60;
  
    displayTime(timeSecond);
  });
  </code></pre>