Controlling the Player’s Paddle
We want the player to be able to control the left paddle using the up or down key on the keyboard. Use two eventListeners: keydown and keyup. Then use the keyCodes for the arrows to make the paddle move. We also need to make sure that the paddle stays on the game board and can’t pass through the top and bottom of the screen. You can now move the paddle and hit the ball.
To move the paddle on this screen, you will need to click in the Results box.