Reverse Accumulator

MediumAcc. 90.2%
+25 XP 10

Backward Thinking

Sometimes we need to process data in the opposite order it was received.

The Assignment

Your function receives an array data.

  1. Use a loop to iterate from the last index down to 0.
  2. Print each element on a new line.

01EXAMPLE 1

Inputdata = [1, 2, 3]
Output3 2 1

Explanation: Output in reverse order.

Constraints

  • Start the loop at array.length - 1.
  • Stop when the index is 0.
ArraysLoops
JavaScript
Loading...
2 Hidden

Input Arguments

data[1,2,3]

Expected Output

3
2
1

Click RUN to test your solution