Key Features Explained
Sub-second Precision: The timer calculates centiseconds (1/100th of a second), which is standard for athletic stopwatches.
Drift Prevention: Instead of simply adding 10ms to a variable, we calculate the difference between the current
Date.now()and thestartTime. This ensures the clock never "drifts" or loses time due to JavaScript engine pauses.Multi-Lap History: The
lap()function captures the current state and prepends it to a scrollable list, allowing the user to track splits without stopping the main timer.Responsive UI: The layout uses Flexbox and relative units, ensuring the buttons and display scale perfectly for mobile screens.
00:00:00.00