arguments[@@iterator]()

@@iterator 属性的初始值是和 Array.prototype.values 属性的初始值相同的对象。

语法

arguments[Symbol.iterator]()

实例

使用for...of循环的迭代

function f() {
  // 你的浏览器必须支持 for..of 循环
  // 以及 for 循环中的 let 区域变量
  for (let letter of arguments) {
    console.log(letter);
  }
}
f('w', 'y', 'k', 'o', 'p');

规范

规范 状态 备注
ECMAScript 2015 (6th Edition, ECMA-262)
CreateUnmappedArgumentsObject
Standard 初始定义.
ECMAScript 2015 (6th Edition, ECMA-262)
CreateMappedArgumentsObject
Standard 初始定义.
ECMAScript Latest Draft (ECMA-262)
CreateUnmappedArgumentsObject
Draft  
ECMAScript Latest Draft (ECMA-262)
CreateMappedArgumentsObject
Draft  

浏览器兼容

Update compatibility data on GitHub
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
@@iterator Chrome Full support 52 Edge Full support 12 Firefox Full support 46 IE No support No Opera Full support Yes Safari Full support 9 WebView Android Full support 52 Chrome Android Full support 52 Firefox Android Full support 46 Opera Android Full support Yes Safari iOS Full support 9 Samsung Internet Android Full support 6.0 nodejs Full support Yes

Legend

Full support  
Full support
No support  
No support

更多