javascript array reverse not working code example
Example 1: js reverse nested array
var reversed = array.map(function reverse(item) {
return Array.isArray(item) && Array.isArray(item[0])
? item.map(reverse)
: item.reverse();
});
Example 2: reverse array in javascript
const reverseArray = arr => arr.reduce((acc, val) => [val, ...acc], [])