`@@iterator` 属性和 `Array.prototype.values()` 属性的初始值均为同一个函数对象。

## 语法

    arr[Symbol.iterator]()

### 返回值

数组的 iterator 方法，默认情况下与 `values()` 返回值相同

## 示例

### 使用 `for...of` 循环进行迭代

    var arr = ['w', 'y', 'k', 'o', 'p'];
    var eArr = arr[Symbol.iterator]();
    // 您的浏览器必须支持for...of循环
    // 以及let —— 将变量作用域限定在 for 循环中
    for (let letter of eArr) {
      console.log(letter);
    }

### 另一种迭代方式

    var arr = ['w', 'y', 'k', 'o', 'p'];
    var eArr = arr[Symbol.iterator]();
    console.log(eArr.next().value); // w
    console.log(eArr.next().value); // y
    console.log(eArr.next().value); // k
    console.log(eArr.next().value); // o
    console.log(eArr.next().value); // p

## 规范

规范名称 | 规范状态 | 备注
--- | --- | ---
ECMAScript 2015 (6th Edition, ECMA-262) Array.prototype[@@iterator]() | Standard | 首次定义
ECMAScript Latest Draft (ECMA-262) Array.prototype[@@iterator]() | Draft |

## 浏览器兼容性

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
`@@iterator` | Chrome Full support 38 | Edge Full support 12 | Firefox Full support 36 Full support 36 No support 27 — 36 Notes Alternate Name Notes A placeholder property named `@@iterator` is used. Alternate Name Uses the non-standard name: `@@iterator` No support 17 — 27 Notes Alternate Name Notes A placeholder property named `iterator` is used. Alternate Name Uses the non-standard name: `iterator` | IE No support No | Opera Full support 25 | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile ? | Firefox Android Full support 36 Full support 36 No support 27 — 36 Notes Alternate Name Notes A placeholder property named `@@iterator` is used. Alternate Name Uses the non-standard name: `@@iterator` No support 17 — 27 Notes Alternate Name Notes A placeholder property named `iterator` is used. Alternate Name Uses the non-standard name: `iterator` | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes | nodejs Full support 0.12

### Legend

Full support
  Full support
No support
  No support
Compatibility unknown
  Compatibility unknown
See implementation notes.
  See implementation notes.
Uses a non-standard name.
  Uses a non-standard name.

## 相关链接

- `Array.prototype.keys()`
- `Array.prototype.entries()`
- `Array.prototype.forEach()`
- `Array.prototype.every()`
- `Array.prototype.some()`
- `Array.prototype.values()`