English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
array.reverse()
var nums = [10, 20, 30, 40, 50]; nums.reverse();Test and see‹/›
The numbers in the table specify the first browser version that fully supports the reverse() method:
Method | |||||
reverse() | 1 | 1 | Is | Is | 5.5 |
Return Value: | Reversed Array |
---|---|
JavaScript Version: | ECMAScript 1 |
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‹/›