title: Javascript How do i check every 5 seconds if a specific key was clicked?
body: <p>In this case, how do i check every 5 seconds if the right arrow button was clicked? Here what i've tried. It only works once and never checks again. What am i doing wrong?</p>
  
  <pre><code>setInterval(KeyPressed, 5000);
  
  window.onkeydown = KeyPressed;
  
  function KeyPressed(k) {
  
      if (k.keyCode == 39) {
          alert("Right Arrow");
      }
  
  }
  </code></pre>