I’ve been working recently on the pomodoro clock code challenge.
I think I have the basic functionality down, but for some reason - pressing the ‘RESET’ button when a session is in play, resets the timer for a split-second only to continue again from where it was before. Any help would be tremendously appreciated!
Hello - I just took a look at your project…I think what will help fix this issue is you will need to clearInterval() inside your reset function. I did notice you have an if statement with a conditional of ‘distance < 0’ to clearInterval(), which is right since you want it to clear if the timer is 0. But that’s also the only way to clear the timer even on reset or pause.
Hope that makes sense
Thanks for your help!
I changed x to a global variable and added clearInterval(x) within the reset function, and that solved the issue. Thanks again!
No problem glad to help!