+ 1

“If” problem

Why’s my alert going off before 0 and my colors changing going off before it hits 10 seconds? https://code.sololearn.com/WDxu9PKKTRXE/?ref=app

4th Jun 2022, 12:50 AM
Junior
Junior - avatar
4 Answers
+ 3
Move the first if block of your myTime function to the end of the function.
4th Jun 2022, 1:08 AM
Simon Sauter
Simon Sauter - avatar
+ 2
I don't know why the original code didn't work as intended. I just tried if this would make a difference and it did.
4th Jun 2022, 1:16 AM
Simon Sauter
Simon Sauter - avatar
+ 1
Okay thanks. But is there an explanation of why i had to move? just so i can not do that again
4th Jun 2022, 1:09 AM
Junior
Junior - avatar
0
hmm interesting
4th Jun 2022, 1:16 AM
Junior
Junior - avatar