If this is your first time creating a javascript game, you are off to a good start. You even accounted for your game page (possibly) scrolling up and down as you use the arrow keys.
Keep it up. You got this!