title: Keylistener in Javascript
body: <p>I'm looking for a <code>KeyListener</code> for a game I'm developing in JavaScript. I have no idea how this would work in real code but it would be something like this: </p>
  
  <pre><code>if(keyPress == upKey)
  {
      playerSpriteX += 10;
  }
  else if(keyPress == downKey)
  {
      playerSpriteY -= 10;
  } 
  </code></pre>
  
  <p>etc...</p>
  
  <p>I searched it up, and Google came up with things that involved AJAX which I don't understand yet. Is there a built in function in JavaScript that does this?</p>