title: JavaScript toggle saturation onKeyDown
body: <p>I have a script that toggles the value of a variable when a key is pressed and the key is lifted. I'm wondering how I can change this so that instead of changing a variable value when a key is pressed, the saturation on the screen will change and when the key is lifted, the saturation will revert to its original value. How can this be done?
  The script:</p>
  <pre><code> let x = 1;
  window.onkeydown = () =&gt; {
  let x = 2;
  };
  
  window.onkeyup = () =&gt; {
   let x = 1;
  }
  </code></pre>
  <p>css to change the screen saturation: <code>filter: saturate(4);</code></p>
  <p>Just to clarify, when the keydown function occurs instead of changing the variable x from 1 to 2, the screen saturation should change to filter: <code>saturate(4);</code> and when the key is lifted, the screen saturation should revert to normal.</p>