Problem Brief
Build an OTP resend / flash-sale countdown timer displaying MM:SS format with Start, Pause, and Reset controls preventing duplicate intervals.
Requirements
- Format remaining seconds cleanly in `[data-testid="timer-display"]` (starts at `01:00` = 60 seconds).
- Clicking `[data-testid="start-btn"]` starts ticking down once per second without creating multiple timers on double-click.
- Clicking `[data-testid="pause-btn"]` stops the interval while keeping remaining seconds.
- Clicking `[data-testid="reset-btn"]` pauses and resets the display back to `01:00`.
Progressive Hints (2)
- Guard `start()` with `if (intervalId !== null) return;` so double clicks cannot stack multiple timers.
- Pad minutes and seconds using `String(val).padStart(2, "0")`.
Reference Solution
Stuck? Load the verified reference code into your editor.
Automated Test Suite
5 Test Cases Ready- Initializes display at 01:00Shows 01:00 cleanly before Start is clicked
- Start decrements timer after ~1.1sRemaining time drops to 00:59 cleanly
- Clicking Start twice does not double-tickInterval guard prevents two simultaneous timers
- Pause freezes countdown cleanlyDisplay stops changing after Pause click
- Reset restores timer back to 01:00 and stops tickingResets display to 01:00
Live Sandboxed Previewiframe sandbox