all templates
Web Basics

Stopwatch

Start, stop, lap — accurate timing that doesn't drift.

A stopwatch with lap times that stays accurate by measuring elapsed time instead of counting ticks — the mistake most first attempts make. A tidy lesson in doing time right.

What's inside

  • Start / stop / reset and lap splits
  • Accurate timing from Date deltas, not tick counting
  • Clean mm:ss.cs formatting
  • Lap list rendered from an array
  • Light & dark mode, no dependencies

Quickstart

$ curl -LO https://devai.io/downloads/stopwatch.zip$ unzip stopwatch.zip && cd stopwatch$ open index.html   # or just double-click the file

Browse the code

The full source, exactly as the zip ships it.

loading…
Download .zip
loading tree…

about this tutorial

A devai.io starter tutorial — the right way to measure time in the browser.