title: Alternative for event's deprecated KeyboardEvent.which property
body: <p>MDN states that <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which" rel="noreferrer"><code>KeyboardEvent.which</code></a> is deprecated. How can I substitute it for a non-deprecated version?</p>
  <p>For example, I have the following:</p>
  <pre><code>window.onkeydown = (event) =&gt; { console.log(event.which); }
  </code></pre>
  <p>I thought <code>event.key.charCodeAt()</code> could substitute <code>event.which</code>, but this won't work for keys such as <kbd>ALT</kbd>, <kbd>CTRL</kbd> or <kbd>ENTER</kbd>, and it only works if <code>event.key.length === 1</code>:</p>
  <pre><code>window.onkeydown = (event) =&gt; { console.log(event.key.charCodeAt()); }
  </code></pre>
  <p>To recap, <code>event.which != event.code</code> and <code>event.which != event.key</code>, therefore I am unable to simply use <code>event.key</code>.</p>
  <p>Is there a substitute for <code>event.which</code> which detects combination keypresses including <kbd>ALT</kbd>, <kbd>CTRL</kbd> or <kbd>ENTER</kbd>?</p>