---
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/Referencia/Objectes_globals/Array/entries
---
{{JSRef}}
El mètode entries()
retorna un nou objecte Array Iterator
que conté els parells clau/valor per a cada posició de l'array.
Sintaxi
arr.entries()
Exemples
var arr = ['a', 'b', 'c'];
var eArr = arr.entries();
console.log(eArr.next().value); // [0, 'a']
console.log(eArr.next().value); // [1, 'b']
console.log(eArr.next().value); // [2, 'c']
Especificacions
Especificació |
Estat |
Comentaris |
{{SpecName('ES6', '#sec-array.prototype.entries', 'Array.prototype.entries')}} |
{{Spec2('ES6')}} |
Definició inicial. |
{{SpecName('ESDraft', '#sec-array.prototype.entries', 'Array.prototype.entries')}} |
{{Spec2('ESDraft')}} |
|
Compatibilitat amb navegadors
{{CompatibilityTable}}
Característica |
Chrome |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
Suport bàsic |
{{CompatChrome("38")}} |
{{CompatGeckoDesktop("28")}} |
{{CompatNo}} |
{{CompatOpera("25")}} |
{{CompatSafari("7.1")}} |
Característica |
Android |
Chrome for Android |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
Suport bàsic |
{{CompatNo}} |
{{CompatNo}} |
{{CompatGeckoMobile("28")}} |
{{CompatNo}} |
{{CompatNo}} |
8.0 |
Vegeu també
- {{jsxref("Array.prototype.keys()")}}
- {{jsxref("Array.prototype.forEach()")}}
- {{jsxref("Array.prototype.every()")}}
- {{jsxref("Array.prototype.some()")}}