Do while always runs at least once before checking the condition, in this case switch to while for the desired behaviour
2024-01-03 21:58:50
10
Mr. X :
Fix on line 10: (seconds >= 0)
2024-01-03 23:15:44
4
Tickle Papa Phila :
Assuming you want it to stop at 1, change the do-while loop into a regular while loop, since do-while will always run at least once
2024-01-03 21:29:36
2
manteeray :
I'm assuming you want it to immediately print happy new year instead of printing 0 and then happy new year? just do a normal while loop instead of do while loop, but (continued in comments)
2024-01-03 21:49:19
2
Svetli :
* while(seconds >= 0)
2024-01-03 21:17:15
2
OddePodde :
Not to edit to much in the code, I would just add to the start of the function if ( seconds <= 0) return clo(“Happy…”)
2024-01-03 22:04:50
1
Lawrence Mawanda :
the error is subtracting 1 from 0
2024-01-18 20:20:24
1
Borleone🌪 :
This code does the “do” part, then checks the “while” condition but since you do 0-1 , you’ll have -1 seconds and this leads to an undefined condition which makes your code not work correctly
2024-01-19 01:00:01
0
blank :
dawg i aint a coder but you do 0-1 and -1 isnt more than 0
2024-01-09 17:51:53
0
Nonfwjz :
console.log("I dont now");
2024-01-14 15:20:03
0
Lego Charmander :
you need to add a settimeout if you wanna count in seconds. also 0 isn't bigger than 0 so the while loop won't run
2024-01-15 14:55:49
0
Lee Morton :
should use a while loop, not a do-while
2024-01-15 19:07:54
0
Gauray 7🇨🇮🇨🇮 Sous-prefet :
seconds>0
2024-01-16 01:00:20
0
ajayi__ :
Less than or equal to 0
2024-01-07 23:09:46
0
ivo :
while(second>=0);
2024-01-22 15:31:32
0
computation :
he is only checking if it is greater than zero and not equal to 0
2024-01-24 03:28:27
0
EC :
Cuz u did seconds > 0 so the int has to be higher than 0
2024-01-27 00:57:50
0
Binary Core Systems :
the condition is not accounting for anything below 0
2024-02-01 05:25:52
0
Ricardo Morim :
it always Run at least once because its a do while
2024-01-08 23:05:28
0
LUQMAN :
0 does not satisfy the iteration of while loop
2024-01-08 17:06:59
0
Jhay :
Line 12 "seconds = seconds - 1;"
When you start the countdown from 0, it'd be 0 - 1, which gives you a "negative second" that is (-1)
2024-01-08 13:10:08
0
panib00 :
So much wrong in this question. Do you want it to print at exactly 1 second before 0? This code will print first "0" and then "Happy New Year!" when you call it with 0. So the solution would be:
2024-01-04 00:12:59
0
Supuupi :
a do while loop runs once before checking the condition. do while "seconds > 0"
but 0 is not > 0. So the code shouldn't run but it does (cuz do while)
2024-01-03 23:26:32
0
Laurentiu Andoni :
Do while will always run one time minimum even if the condition is false!
2024-01-03 22:45:24
0
Roblox Studio :
It runs the code and after that it checks the condition
2024-01-03 22:14:04
0
To see more videos from user @itstundealao, please go to the Tikwm
homepage.