0
Could anyone please help me out with this one?
Write a program-timer, that will take the count of seconds as input and output to the console all the seconds until timer stops. function main() { var seconds = parseInt(readLine(), 10) // Your code here var i = 0; while(i <= seconds){ console.log(i); i++; } } Sololear output is 6,5,4,3,2,1,0. My output is 0,1,2,3,4,5,6.
2 Antworten
+ 1
you don't need i variable:
while (0 <= seconds) {
console.log(seconds);
seconds--;
}
+ 2
while(seconds>=0) {
console.log(i)
seconds--;
}