Javascript Reference - JavaScript Array reverse() Method








reverse() method reverses the order of items in an array.

Browser Support

reverse() Yes Yes Yes Yes Yes

Syntax

array.reverse()

Parameters

None

Return Value

reverse() function returns an array in reversed order.





Example


var values = [1, 2, 3, 4, 5]; 
values.reverse(); 
console.log(values); //5,4,3,2,1 

reverse() returns a reference to the resulting array.

The code above generates the following result.