[Solved] Detect alternating key events

You only need one event listener, and you need to define the a key press state variable (x) outside of the listener function so that it can be referenced by subsequent executions of the listener function. You also need to make sure that you reset the a key press variable after the b key press. … Read more