Implement a hook useCountdown(initialValue, interval) that manages a countdown timer.
The hook should:
value: current countdown value.start(): function to start the countdown.pause(): function to pause the countdown.reset(): function to reset to the initial value.Examples
const countdown = useCountdown(10, 1000); countdown.start(); // countdown.value decreases from 10 to 0 every second countdown.pause(); // pauses the countdown countdown.reset(); // resets value to 10
JavaScript Function
No test results yet
Click "Run" to execute tests