From a55b575e8089ee6cab7c5c262a7e6db55d0e34d6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:46:50 +0100 Subject: unslug es: move --- .../global_objects/array/entries/index.html | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 files/es/web/javascript/reference/global_objects/array/entries/index.html (limited to 'files/es/web/javascript/reference/global_objects/array/entries') diff --git a/files/es/web/javascript/reference/global_objects/array/entries/index.html b/files/es/web/javascript/reference/global_objects/array/entries/index.html new file mode 100644 index 0000000000..89fef6475f --- /dev/null +++ b/files/es/web/javascript/reference/global_objects/array/entries/index.html @@ -0,0 +1,86 @@ +--- +title: Array.prototype.entries() +slug: Web/JavaScript/Referencia/Objetos_globales/Array/entries +tags: + - Array + - ECMAScript 2015 + - Iterador + - Iterator + - JavaScript + - Prototipo + - metodo +translation_of: Web/JavaScript/Reference/Global_Objects/Array/entries +--- +
{{JSRef}}
+ +
El método entries() retorna un nuevo objeto Array Iterator que contiene los pares clave/valor para cada índice de la matriz.
+ +
 
+ +
+

{{EmbedInteractiveExample("pages/js/array-entries.html")}}

+
+ +

Sintaxis

+ +
arr.entries()
+ +

Valor de retorno

+ +

Un nuevo objeto iterador {{jsxref("Array")}}.

+ +

Ejemplos

+ +

Usando un bucle for…of 

+ +
var a = ['a', 'b', 'c'];
+var iterator = a.entries();
+
+for (let e of iterator) {
+  console.log(e);
+}
+// [0, 'a']
+// [1, 'b']
+// [2, 'c']
+ +

Especificaciones

+ + + + + + + + + + + + + + + + + + + +
EspecificaciónEstadoComentarios
{{SpecName('ES6', '#sec-array.prototype.entries', 'Array.prototype.entries')}}{{Spec2('ES6')}}Definición inicial.
{{SpecName('ESDraft', '#sec-array.prototype.entries', 'Array.prototype.entries')}}{{Spec2('ESDraft')}} 
+ +

Compatibilidad con navegadores

+ +
+

{{Compat("javascript.builtins.Array.entries")}}

+
+ +
 
+ +

Ver también

+ + -- cgit v1.2.3-54-g00ecf