Here's a simple basketball game implemented as a single HTML file, containing JavaScript enclosed in script tags:
To play the game, you can copy the above code into a new HTML file and open it in a web browser. The game displays a basketball hoop at the top of the canvas and a ball at the bottom. Use the left and right arrow keys to move the hoop and try to catch the falling ball in the hoop. Each time the ball passes through the hoop, your score increments by one. The game continues indefinitely.