title: Keystroke to ASCII Value
body: <p>I want to take a keystroke and get its ASCII representation. This includes when the SHIFT key is pressed, i.e. </p>
  
  <ul>
  <li>"shift =" returns 43</li>
  <li>"a" returns 97</li>
  <li>"shift a" returns 65</li>
  </ul>
  
  <p>Is there a way I can do this without writing a lot of code?</p>
  
  <p>Edit:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.onkeypress = function () {
    console.log(event.which);
  }</code></pre>
  </div>
  </div>
  </p>