reverse order in javascript code example
Example 1: javascript reverse array
var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);
Example 2: js reverse nested array
var reversed = array.map(function reverse(item) {
return Array.isArray(item) && Array.isArray(item[0])
? item.map(reverse)
: item.reverse();
});