Pomodoro Clock Problem : Increment/ decrement

Hi, I’m working on the pomodoro clock front-end project and I have an error in my javascript, I think, and I can’t seem to find the problem. So as you can see in my codepen (link below), when the session length is equal to the break length it will change both values and I don’t understand why. Could anybody explain this to me? Thank you.


Let’s assume both break and session times are equal to, say, 7 min. Say you click the increment for the session time. The increment function is called and the switch checks if x (also the session time), which is 7, is equal to the break time, which happens to be the case, as both are 7, and as a result it adds 1 to break time and leaves session time unchanged.

You need to clearly let the two functions know that session or break increment or decrement buttons were clicked (add another argument, maybe).

Also, avoid in line event triggers, it makes it difficult to read your code.

And are you using bundle.JS tester? Because the break and session can be set to null should be 1.