How to detect if multiple keys are pressed at once using JavaScript?
问题 I\'m trying to develop a JavaScript game engine and I\'ve came across this problem: When I press SPACE the character jumps. When I press → the character moves right. The problem is that when I\'m pressing right and then press space, the character jumps and then stops moving. I use the keydown function to get the key pressed. How can I check if there are multiple keys pressed at once? 回答1: Note: keyCode is now deprecated. Multiple keystroke detection is easy if you understand the