0
Help for 19.2 JavaScript
Hello guys, I need help for my code. I was trying to do the practice 19.2 of the JavaScript Course, but I’m stuck in there. I have a solution but it won’t work. Can you help me? Here is my solution: function main() { var seconds = parseInt(readLine(), 10); while(seconds>=0){ document.write(seconds+"</br>"); seconds--; } Im would welcome your response. Hendrik
9 odpowiedzi
+ 2
Hendrik Nordenholt
while(seconds >= 0) {
console.log(seconds)
seconds--;
}
0
use console log for output & don't include html break line tag.
0
Write a program-timer, that will take the count of seconds as input and output to the console all the seconds until timer stops.
This is the task.
And thanks for the answer. I will try it
0
I tried the solution of zexu knub and it didnt work. Do you have an other solution ?
0
Hendrik Nordenholt
Add a semicolon in the first statement of zexu knub 's code and it'll work.
0
Arun Ruban SJ it will work even without semicolon.
0
zexu knub
Thank you, I didn't know about this in javascript. Does every statement works without semicolon or just the console??
0
Arun Ruban SJ Mostly, JS have Automatic Semicolon Insertion ( ASI ). which Insert a semicolon automatically even when you don't write manually.
0
Ok thanks