Help with Pomodoro Clock pause feature

Help with Pomodoro Clock pause feature
0

#1

Hello,

I got my timer to start but I can’t get my timer to pause or reset. Is there a way to stop the stopTimer function that I created?

I tried startTimer().stop();
clearInterval(timeIntervalID);

But I don’t think I am using it right.

Thank You.


#2

You have many errors showing in the console right now. You should fix those first. You can not use clearInterval(timeIntervalID), because you have not defined what timeIntervalID is in your code. Your function function startTimer does not create an object, so trying to call a stop method on it does not work. Also, you declared a local variable called displayMinute inside your startTimer function but did not assign it a value, so it by default is undefined. Then in the setInterval callback function, you attempt to assign minutes to displayMinute.textContent. Since displayMinute is undefined, there is no such thing as a textContent property of a undefined.

It is not a matter of stopping the startTimer function you created, but you could use clearInterval(timeIntervalID) if timeIntervalID was declared globally. You declare it locally inside the startTimer function, so if you try to reference it outside that function, it will not work.


#3

Thank you for your feedback.