Reflect.enumerate()

已废弃
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Reflect.enumerate()静态方法通常返回目标对象自身和继承的可迭代属性的一个迭代器,在ECMAScript 2016中已被移除,在各浏览器中已被废弃。

语法

Reflect.enumerate(target)

参数

target
获取属性的目标对象。

返回值

目标对象自身和继承的可迭代属性的一个迭代器。

Exceptions

 Object.

描述

Reflect.enumerate()方法返回目标对象自身和继承的可迭代属性的一个迭代器。

案例

使用 Reflect.enumerate()

var obj = { x: 1, y: 2 };

for (var name of Reflect.enumerate(obj)) {
  console.log(name);
}
// logs "x" and "y"

规范

Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
Reflect.enumerate
Standard 初始定义。ECMAScript 2016中已移除。

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 未实现 未实现 未实现 未实现
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 未实现 未实现 未实现 未实现

参照