reverse a arra code example
Example 1: how to reverse an array in javascript
array = [1 2, 3]
reversed = array.reverse()
Example 2: reverse array in javascript
const reverseArray = arr => arr.reduce((acc, val) => [val, ...acc], [])
array = [1 2, 3]
reversed = array.reverse()
const reverseArray = arr => arr.reduce((acc, val) => [val, ...acc], [])