title: How can I disable repetition of an eventListener keydown event in plain JavaScript
body: <p>I am trying to stop a keydown event from repeating for a game. I am unable to use libraries due to it being part of a school project. I have tried most of the answers I can access but they don't work for my code, I also can't use MDN because it's blocked. Here is the code</p>
  <pre><code>     window.addEventListener(&quot;keydown&quot;, function (e){
        if (e.keyCode == 32) {
         accelerateBy = -0.5
         accelerate()
        
       }
      });
  </code></pre>