reversing an array in js
snippet in javascript

reversing an array in js

user9249

var arr=[1,2,5,6,2]
arr.reverse()

javascript reverse array

user1817

var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);

reverse an array javascript

user2824

const reversed = array1.reverseconst reversed = array1.reverse();
console.log('reversed:', reversed);
// expected output: "reversed:" Array ["three", "two", "one"]();
console.log('reversed:', reversed);
// expected output: "reversed:" Array ["three", "two", "one"]const reversed = array1.reverse();
console.log('reversed:', reversed);
// expected output: "reversed:" Array ["three", "two", "one"]