DEV Community

Madalina Pastiu
Madalina Pastiu

Posted on

Reverse List Order

Instructions:

In this kata you will create a function that takes in a list and returns a list with the reverse order.

Examples (Input -> Output)

  • [1, 2, 3, 4] -> [4, 3, 2, 1]
  • [9, 2, 0, 7] -> [7, 0, 2, 9]

Thoughts:

For this requirement arrays has the reverse() method, that reverse the array/list.

Solution:

function reverseList(list) {
  return list.reverse();
}
Enter fullscreen mode Exit fullscreen mode

This is a CodeWars Challenge of 8kyu Rank

Top comments (0)