Answers for "3 ways to reverse an array in javascript ongaeis"

PHP
55

javascript reverse array

var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);
Posted by: Guest on November-16-2019
1

reverse array elements in javascript

// reverse array elements in javascript
const arr = ["first", "second", "third"];
arr.reverse(); // Mutates the array
console.log(arr); // ["third", "second", "first"]
Posted by: Guest on January-19-2022

Code answers related to "3 ways to reverse an array in javascript ongaeis"

Browse Popular Code Answers by Language