The Countdown Clock

EasyAcc. 98.7%
+15 XP 5

Counting Down

Usually, for loops count upwards. But by changing the starting point and using a decrement operation, you can walk backward through time.

The Assignment

Your function receives a parameter named startValue.

  1. Write a for loop that initializes a variable i to exactly the value of startValue.
  2. The loop should continue as long as i is greater than or equal to 1.
  3. Move the value of i downward by 1 in each step.
  4. Inside the loop, print the current value of i.

01EXAMPLE 1

InputstartValue = 10
Output10 9 ... 1

Explanation: Counts down from 10 to 1.

02EXAMPLE 2

InputstartValue = 3
Output3 2 1

Explanation: Counts down from 3 to 1.

Constraints

  • Use a standard for loop.
  • Print each number on a new line.
LoopsFundamentals
JavaScript
Loading...
4 Hidden

Input Arguments

startValue10

Expected Output

10
9
8
7
6
5
4
3
2
1

Click RUN to test your solution