Stopwatch

Yangshun TayEx-Meta Staff Engineer
Languages

Build a stopwatch widget which can measure how much time has passed. It shows the current timer and has two buttons underneath: "Start/Stop" and "Reset".

Requirements

  • Start/Stop Button: Starts/stops the timer depending on whether the timer is running.
  • Reset: Resets the timer to 0 and stops the timer.
  • The timer shows the number of seconds elapsed, down to the millisecond.
    • Clicking on the timer should start/stop the timer. The Start/Stop button's label should update accordingly as well.
    • It'd be a nice optional addition to format the time to display in hh:mm:ss:ms format.

You are free to exercise your creativity to style the appearance of the stopwatch. You can try out Google's stopwatch widget for inspiration and an example.

Asked at these companies

Premium featurePurchase premium to see companies which ask this question.
View plans

Code Editor

Start coding your solution here

Loading editor

Browser preview and Console

Test and preview your UI in real time
For the best experience, switch to desktop.