entries()
method returns a new
Iterator
object that contains
an array of
[value, value]
for each element in the
Set
object, in insertion order. For
Set
objects there is no
key
like in
Map
objects. However, to keep the API similar to the
Map
object, each
entry
has the same value for its
key
and
value
here, so that an array
[value, value]
被返回。
mySet.entries()
A new
Iterator
object that contains an array of
[value, value]
for each element in the given
Set
, in insertion order.
var mySet = new Set();
mySet.add('foobar');
mySet.add(1);
mySet.add('baz');
var setIter = mySet.entries();
console.log(setIter.next().value); // ["foobar", "foobar"]
console.log(setIter.next().value); // [1, 1]
console.log(setIter.next().value); // ["baz", "baz"]
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of 'Set.prototype.entries' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entries
|
Chrome 38 | Edge 12 | Firefox 24 | IE No | Opera 25 | Safari 8 | WebView Android 38 | Chrome Android 38 | Firefox Android 24 | Opera Android 25 | Safari iOS 8 | Samsung Internet Android 3.0 | nodejs 0.12 |
完整支持
不支持
Set
Function
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()