Write a program-timer, that will take the count of seconds as input and output to the console all the seconds until timer stops? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a program-timer, that will take the count of seconds as input and output to the console all the seconds until timer stops?

How can do it? My code- function main() { var seconds = parseInt(readLine(), 10) // Your code here while (seconds >= 0){ document.write(seconds+ "<br>"); seconds--; } }

27th Jan 2022, 5:50 PM
Atahar Shihab Dipu
2 Answers
+ 1
Could you add some details ? I suggest to replace document.write line with (console.log(seconds + " ")). Maybe the output is governed by time, which means every one second an output should appear.
27th Jan 2022, 8:31 PM
Mohammed
+ 1
Working!
28th Jan 2022, 4:29 AM
Atahar Shihab Dipu