Hi everyone, i’m very stuck on this FCC challenge. In practice, my code go until 00:00 and change to a session or break, but when I launch the test, the first test under #timer says:
And goes the same for 9 to 15 test on this hashtag. I’ve been searching and i think it’s because “setInterval” does not decrement exactly, but I don’t know how can I fix it. Here’s my code:
So please, would someone give an advice to fix my code? I’ve been stuck for almost two weeks. By the way, excuse my poorly english, I’m not a native speaker.
Your initial state is set to Break and should be set to Session.
When your countdown reaches zero, you never set it to the break or session length, so it continues counting down into negative numbers. You need to set the state to the break or the session length when it reaches 00:00.
check if the seconds are 0 and the minutes are zero, if they both are then set the render to “00:00” and change your countdown variable to the break minutes, also, add an onBreak property on your state because you will also need to toggle from break to session