English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript Array reverse() Method

 JavaScript Array Object

The reverse() method reverses the order of elements in the array.

The first array element becomes the last, and the last array element becomes the first.

Syntax:

array.reverse()
var nums = [10, 20, 30, 40, 50];
nums.reverse();
Test and see‹/›

Browser Compatibility

The numbers in the table specify the first browser version that fully supports the reverse() method:

Method
reverse()11IsIs5.5

Technical Details

Return Value:Reversed Array
JavaScript Version:ECMAScript 1

More Examples

The following example creates a multidimensional array and then reverses the array:

var nums = [[0, 1], [2, 3], [4, 5];
nums.reverse();
Test and see‹/›

 JavaScript Array Object