Inbuilt function clearInterval is not working Javascript
I am learning setTimeout
, setInterval
, clearInterval
functions.
I am learning setTimeout
, setInterval
, clearInterval
functions.
I want to make a Reverse Countdown Timer in which that has an input field and when I type a number and press the “Enter” key, the countdown starts. but the problem is when I want to stop the previous interval and starts new interval with new number and press Enter key, it runs parallel with previous one.
So, we have this simple React component that receives an integer from the father component. When the button is clicked, we display the integer on the screen and the countdown begins.