title: `e.getModifierState is not a function` error on triggered keyup event
body: <p>I am trying to detect whether the client has their CapsLock enabled by temporarily creating a hidden input field, triggering a <code>keyup</code> event on that input, and then checking the boolean value of <code>e.getModifierState('CapsLock')</code>.</p>
  <p>The function I've written is below, which currently throws the error <code>Uncaught TypeError: e.getModifierState is not a function</code> on the line which includes <code>e.getModifierState</code> and I'm struggling to diagnose why this is occurring. I'm open to any help here!</p>
  <pre class="lang-js prettyprint-override"><code>let checkCaps = () =&gt; {
      let tempInput = document.createElement('input');
      let keyupEvent = new Event('keyup');
      tempInput.type = 'hidden';
      tempInput.id = 'check-caps';
      let capsOn = false;
      tempInput.addEventListener('keyup', e =&gt; {
          e.which = 65;
          capsOn = e.getModifierState('CapsLock');
      })
      tempInput.dispatchEvent(keyupEvent);
      tempInput.remove();
      return capsOn;
  }
  
  checkCaps(); // testing the function
  </code></pre>