I am writing event handlers in jQuery. I want to use a specific set of keys (eg arrow keys) for a particular action. Is there a shorthand notation for this?
I have this.
if(event.keycode == 37 || event.keyCode == 38 || event.keyCode == 39)
I’m wondering if there are ranges in JavaScript, like (37..40)?
Thanks in advance!
You can achieve the range effect by using the comparison operators, like so: