Stopwatch

Yangshun TayEx-Meta Staff Engineer
语言

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.
  • Display the elapsed time as a button, formatted into hours, minutes, seconds, and two-digit hundredths of a second. Leading zero-valued hour and minute segments may be omitted.
    • Complete units should carry at their exact boundaries rather than overflow into the smaller unit.
    • Clicking on the timer should start/stop the timer. The Start/Stop button's label should update accordingly as well.

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.

Hints

在这些公司提问

Unlock company signalsPremium shows which companies ask this question so you can prioritize practice by target company.
Unlock

加载编辑器

    Stopwatch 在 React | UI 面试问题