Stuck with Pomodoro Clock Project

Please send help!
I got the UI down but can’t seem to figure out how to get the algorithm for the actual timer started.
Here’s what I have so far:

I appreciate any feedback in advanced.

thank you!

Hi, you can use setTimeout or setInterval to decrease the “remaining time” while “remaining time” is larger than zero.

First point, nice job on the UI.

Second, doesn’t answer your question but something you may have overlooked, your session/break timer +/- feature currently allows you to select a negative number for either, you’ll want to account for that and prevent a user from being able to select a negative (and maybe even a 0) time.

The algorithm, don’t overthink it. You can do something simple like

some pseudo code.

foo(minute, second) {
  // clock here will be your dom element for the actual timer.
  clock.textContent = `${minute}:${second}`;
  if minute and second === 0: return;
  if second === 0 and minute !==0 then subtract 1 from minute, set second = 60
  s -= 1

 var something = setTimeout(foo(minute, second));

when a button is clicked, add eventListener('click', () => foo(5, 30))

then we can call this function we can pass in the time( a literal or a variable containing the values from your session/break timer).

This is just one way, an idea to get you started.

Thank you so much! I got it to work now. It is definitely simpler than other examples I’ve found online.
I just need to fix a few bugs and clean up the code.

Here it is: