The Wayback Machine - https://web.archive.org/web/20220621064538/https://www.geeksforgeeks.org/javascript-array-reverse-method/amp/

JavaScript Array reverse() Method

Below is the example of Array reverse() method.

The arr.reverse() method is used for in-place reversal of the array. The first element of the array becomes the last element and vice versa.

Syntax:

arr.reverse()

Parameters: This method does not accept any parameter

Return value: This method returns the reference of the reversed original array.



Below examples illustrate the JavaScript Array reverse() method:

Code for the above method is provided below:
Program 1:




<script>
function func() {
  
    // Original Array
    var arr = [34, 234, 567, 4];
    document.write(arr);
  
    // Reversed array
    var new_arr = arr.reverse();
    document.write("<br>");
    document.write(new_arr);
}
func();
</script>

Output:

34, 234, 567, 4
4, 567, 234, 34

Supported Browsers: The browsers supported by JavaScript Array reverse() method are listed below:




Article Tags :