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 (ECMA-262)
CreateUnmappedArgumentsObject
Living Standard  
ECMAScript (ECMA-262)
CreateMappedArgumentsObject
Living Standard  

浏览器兼容

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
@@iteratorChrome Full support 52Edge Full support 12Firefox Full support 46IE No support NoOpera Full support 39Safari Full support 9WebView Android Full support 52Chrome Android Full support 52Firefox Android Full support 46Opera Android Full support 41Safari iOS Full support 9Samsung Internet Android Full support 6.0nodejs Full support Yes

Legend

Full support  
Full support
No support  
No support

更多