Pomodoro clock porject

Good evening guys. I need help with the pomodory clock. It seems that my buttons are not working properly. I was wondering if someone can take a look at my code and help me with the problem. The buttons won’t click. here’s my link https://codepen.io/alexbuster/pen/qBXeBmY?editors=1010
please help and thanks in advance.

Actually, they are clicking, and your event handlers are catching the clicks. If you don’t believe me try adding a console.log inside each handler and then watch for them to print out in the console.

So the question is, if your handlers are catching the clicks then why isn’t session length being incremented/decremented on the page? Ahh, the bane of developers everywhere, typos. Make sure you are spelling the id for that element the same everywhere you reference it.

2 Likes

Thanks alot bbsmooth it was staring at my face and I didn’t even see it. I appreciate you time and effort. I realized that I should pay much close attention to the spelling.

Happens to the best of us. If we all had a second pair of eyes we’d find all of our typos :smiley:

Hey by the way, sorry to bother you but I was working in the calculator project and there is a user story that I can’t quite get and is tha las one. 13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign. May be you can take a look at it. I’ve tried everywhere to find the answer but can’t seem to get the right solution. Here’s the link https://codepen.io/alexbuster/pen/ZEyqaKw

When you click on an operator button it calls chooseOperation(). The last thing this function does is

this.currentOperand = ''

And the first thing it checks is

if (this.currentOperand === '') return

So you can see how if you click on multiple operator buttons in a row that only the first one will work because all subsequent ones will just return since this.currentOperand will be the empty string.

I don’t have specific code suggestions for fixing this. You’ll just need to rethink your approach about how to handle multiple operator buttons in a row so that the last one is assigned to this.operation.

Also, if you need further help with this then definitely start a new thread.

Thanks for your explanation and your time. God bless have a great day!