Countdown | Sololearn: Learn to code for FREE!



Why is my seconds number going in the negatives and my hour number not working?

8/7/2022 3:51:09 PM

Your Mom

6 Answers

New Answer


At line 31 & 37, I think... minutePrompt = 60; secondPrompt = 60; That worked for me. You just have second = 60 and minute = 60. They are the variable labels you used.


Damn it's too late for me to play around now. I'll try tomorrow. My idea would be to check why the minutes and seconds work and not the hours. Surely there's something to add to make it work. Maybe you need to include in your if statements a check that each number above it is greater than 0..?


You haven't specified a condition where the numbers should be positive only. So add a condition beffore all of others like: if hours<0 || minutes<0: do_the_ending_thing();


i did that but still not workinf


This is a sample made in Python: You can implement this aproach in js.


oh yes i forgot to put prompt there. but when my hour thing === 0 the minute and seconds dont work