`reverse()` 方法将数组中元素的位置颠倒,并返回该数组。该方法会改变原数组。

## 语法

     arr.reverse()

### 参数

无

## 描述

`reverse` 方法颠倒数组中元素的位置，并返回该数组的引用。

## 示例

### 例子：颠倒数组中的元素

下例将会创建一个数组 sourceArray，其包含三个元素，然后颠倒该数组。

    var sourceArray = ['one', 'two', 'three'];
    var reverseArray = sourceArray.reverse();

    console.log(sourceArray ) // ['three', 'two', 'one']
    console.log(sourceArray === reverseArray); // true

## 规范

Specification | Status | Comment
--- | --- | ---
ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.1
ECMAScript 5.1 (ECMA-262) Array.prototype.reverse | Standard |
ECMAScript 2015 (6th Edition, ECMA-262) Array.prototype.reverse | Standard |

## 浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

| Desktop | Mobile | Server
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | Node.js
`reverse` | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile Full support Yes | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes | nodejs Full support Yes

### Legend

Full support
  Full support

## 相关链接

- `Array.prototype.join()`
- `Array.prototype.sort()`
- `TypedArray.prototype.reverse()`