title: How to check KeyboardEvent.key in specific range in Javascript
body: <p>In Javascript, I have callback function for keydown event. I use <code>keyCode</code> and <code>which</code> properties to detect which keys user pressed.  </p>
  
  <pre><code>var keyPressed = event.keyCode || event.which;
  if (keyPressed &gt; 47 &amp;&amp; keyPressed &lt; 58) {
      //do something
  }
  </code></pre>
  
  <p>It works well. However, this properties are deprecated, I switch to <code>key</code> property. When I replace code, it does not work correctly.  </p>
  
  <pre><code>if (event.key &gt; 47 &amp;&amp; event.key &lt; 58) {
          //do something
  }
  </code></pre>
  
  <p>I can't check user's pressed key in range.</p>