Clock 25+5 tests 9,10 ,11

good morning so i would like a clear mind to help me out on this code seems to run fine
but it fails 3 tests: test 9 test 10 and test 11

this is my code:

i cant post specific part of code because i dont wich is at wrong exactly

It’s the delay between starting the clock and changes to the display, which take 2 seconds. I’ve added some logging to the start and timer functions and on a new session, you can see that it takes 2 seconds before the update changes to ‘24:59’ (timestamps are in milliseconds; before/after is relative to decrementing sessionSeconds):

"started: 1673102436920"
"updating time before: 1673102437924 1500"
"updating time displaying min: 25 s: 0"
"updating time after: 1673102437925 1499"
"updating time before: 1673102438928 1499"
"updating time displaying min: 24 s: 59"
"updating time after: 1673102438928 1498"

This delay is cause because the setInterval waits one second before running your timer and then nothing changes on the display due to the timer for another second. Without giving you the answer, there is a fairly standard way of using setInterval and running the callback immediately that you should research.

thank you very much that was the problem i made the adjachment and everything is good now

have a great night

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.