Back to Hub

Pure JavaScript Pong: Where I Started

Pure JavaScript Pong game

Why this project still matters

Pong was my first programming project. Two paddles, a ball, keyboard input, collision detection - nothing glamorous, but it proved I could ship something playable in the browser.

How it works

The game runs on the HTML canvas with a simple game loop: update positions, bounce off walls and paddles, score when the ball passes a paddle. Player one uses W/S; player two uses arrow keys.

What it taught me

  • Update vs draw. Splitting simulation from rendering made the loop easier to reason about.
  • Frame timing. Getting smooth motion without a game engine meant learning requestAnimationFrame the hard way.
  • Feel debugging. Physics that looks wrong rarely throws an error - I had to watch values, not stack traces.

Every later project - auth systems, malware tools, TypeScript apps - traces back to the confidence this build gave me.

What I'd improve next

Touch or mobile controls, a simple score reset UX, and cleaner separation of input handling from the draw loop if I ever refactor it for fun.

Play it

It still runs in the browser exactly as it did in 2022.

Play live Source code