Last active
August 29, 2015 13:57
-
-
Save isner/9553406 to your computer and use it in GitHub Desktop.
inArray-like check for event.which
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var which = event.which; // or whatever defines `which` | |
var chars = [1, 2, 3, 4]; | |
if (iPressedOneOfThese(chars)) { | |
// Do my stuff | |
} | |
function iPressedOneOfThese(array) { | |
array.filter(chars, function (char) { | |
return which === char; | |
}).length | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment