Countdown | Sololearn: Learn to code for FREE!

+1

Countdown

Why is my seconds number going in the negatives and my hour number not working? https://code.sololearn.com/WlQITx1G8Ajm/?ref=app

8/7/2022 3:51:09 PM

Your Mom

6 Answers

New Answer

+1

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.

+1

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..?

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();

0

i did that but still not workinf

0

This is a sample made in Python: https://code.sololearn.com/c945fGpS8I2H/?ref=app You can implement this aproach in js.

-1

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