@@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
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung InternetNode.js
Basic supportChrome Full support 52Edge ? Firefox Full support 46IE No support NoOpera Full support YesSafari Full support 9WebView Android Full support 52Chrome Android Full support 52Edge Mobile ? Firefox Android Full support 46Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support 6.0nodejs Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

更多

文档标签和贡献者

此页面的贡献者: fscholz, wizardforcel, wohugb
最后编辑者: fscholz,