Javascript Array reverse() method
The reverse() method is used to reverse the order of elements in an array. It modifies the array in place and returns a reference to the same array with the reversed order.
Syntax:
array.reverse()
Example : Here is an example shows the use of the Array reverse() method.
let array = [1, 2, 3, 4, 5];
array.reverse();
console.log(array);
Output
[ 5, 4, 3, 2, 1 ]
JavaScript Array Methods
JavaScript array methods are built-in functions that allow efficient manipulation and traversal of arrays. They provide essential functionalities like adding, removing, and transforming elements, as well as searching, sorting, and iterating through array elements, enhancing code readability and productivity.
Learn More on JavaScript Array
Now let’s look at the JS array methods and properties.