title: Prevent JavaScript keydown event from being handled multiple times while held down
body: <p>I have this code:</p>
  
  <pre><code>else if (e.keyCode == 32){
        fired = true;
  </code></pre>
  
  <p>In a keyDown function (I have added the document.addEventListener code). Now it works just fine, and does exactly what I want it to do. But here's the problem: if you <em>hold down</em> the key, it keeps making fired = true over and over again continuously until it is released. I just want it to set fired = true; once, even if the key is held down.</p>