Pomodoro Timer
How I solved the problem
I had a startTimer function, assigned a variable called presentTime to get the value by its id. An If statement t check if presentTime is strickly equal to “00:00” if its true it should get the value and if not, I assigned timeArray there splited presentTime with collons, assigned min to timeArray index 0 and assigned second to checkSecond into timeArray index 1 - 1 to get to the last index. If statement which checks if the seconds are equal to 59 if its true min subtract 1.
An if statement which checks if the min is strickly equal to “00” and if seconds is strickly equal to “00” and if its true the time should stop by its self.
I am using document.getElementById to get the value of the time for min and second. Assigned the timer to setTimerout
A function to checkSecond and a parameter named sec if the function I had an if statement which will evaluate if sec is less than 10 and if sec is greater or equal to 0, if its true it should return 0 plus sec and if sec id less than 0 it should give us sec equal to 59, then return sec.
lastly a function to stop the clock I am using document.getElementById to get the value which should be “00:00”.
Conclusion
Lastly a function to stop the clock I am using document.getElementById to get the value which should be “00:00”. On this exercise it was fun but a bit challenging.