--- title: Array.prototype.entries() slug: Web/JavaScript/Reference/Global_Objects/Array/entries translation_of: Web/JavaScript/Reference/Global_Objects/Array/entries original_slug: Web/JavaScript/Referencje/Obiekty/Array/entries ---
Metoda entries() zwraca obiekt Iteratora który zawiera parę klucz/wartość dla każdej pozycji w tablicy.
a.entries()
Nowy iterator {{jsxref("Tablicy")}}.
var a = ['a', 'b', 'c'];
var iterator = a.entries();
for (let e of iterator) {
console.log(e);
}
// [0, 'a']
// [1, 'b']
// [2, 'c']
| Specyfikacja | Status | Komentarz |
|---|---|---|
| {{SpecName('ES2015', '#sec-array.prototype.entries', 'Array.prototype.entries')}} | {{Spec2('ES2015')}} | Initial definition. |
| {{SpecName('ESDraft', '#sec-array.prototype.entries', 'Array.prototype.entries')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.Array.entries")}}