Array.prototype.entries()
De entries()
funtie geeft een nieuw Array Iterator
object dat de key/value paren bevat voor elk onderdeel van de array.
var a = ['a', 'b', 'c'];
var iterator = a.entries();
console.log(iterator.next().value); // [0, 'a']
console.log(iterator.next().value); // [1, 'b']
console.log(iterator.next().value); // [2, 'c']
Syntax
a.entries()
Return waarde
Een nieuw Array
iterator object.
Voorbeelden
De for…of loop
var a = ['a', 'b', 'c'];
var iterator = a.entries();
for (let e of iterator) {
console.log(e);
}
// [0, 'a']
// [1, 'b']
// [2, 'c']
Specificaties
Specificatie | Status | Opmerkingen |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Array.prototype.entries' in that specification. |
Standard | Standaard definitie. |
ECMAScript (ECMA-262) The definition of 'Array.prototype.entries' in that specification. |
Living Standard |
Browser compatibiliteit
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!
Functie | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basis ondersteuning | 38 | 28 (28) | Niet ondersteund | 25 | 7.1 |
Functie | Android | Chrome voor Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basis ondersteuning | Niet ondersteund | Niet ondersteund | 28.0 (28) | Niet ondersteund | Niet ondersteund | 8.0 |