Try it live

Pick a target below, then press Run (or Ctrl+Enter). Your code runs locally in your browser — nothing is uploaded anywhere.


Tips

  • Every JavaScript snippet in the lessons has a Run in playground button — it loads the code here in the right mode automatically.

  • Canvas mode gives you ctx (a 2D drawing context), W and H (640 × 360), plus clear() to wipe and redraw.

  • Page mode gives you page (the dashed stage box above) — create elements, move them with Math.cos / Math.sin.

  • Both modes give you print() (writes to the output panel) and loop(fn) (calls fn(t) every animation frame; starting a new run stops the old one).

  • Errors appear in the output panel — read them, they are part of the lesson.

Next: Project: Analog Clock — Unit 5 turns this playground into full projects.