aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/javascript/reference/global_objects/array/entries/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/es/web/javascript/reference/global_objects/array/entries/index.html')
-rw-r--r--files/es/web/javascript/reference/global_objects/array/entries/index.html87
1 files changed, 87 insertions, 0 deletions
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..3db699e1d5
--- /dev/null
+++ b/files/es/web/javascript/reference/global_objects/array/entries/index.html
@@ -0,0 +1,87 @@
+---
+title: Array.prototype.entries()
+slug: Web/JavaScript/Reference/Global_Objects/Array/entries
+tags:
+ - Array
+ - ECMAScript 2015
+ - Iterador
+ - Iterator
+ - JavaScript
+ - Prototipo
+ - metodo
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/entries
+original_slug: Web/JavaScript/Referencia/Objetos_globales/Array/entries
+---
+<div>{{JSRef}}</div>
+
+<div>El método <code><strong>entries()</strong></code> retorna un nuevo objeto <strong><code>Array Iterator</code></strong> que contiene los pares clave/valor para cada índice de la matriz.</div>
+
+<div> </div>
+
+<div>
+<p>{{EmbedInteractiveExample("pages/js/array-entries.html")}}</p>
+</div>
+
+<h2 id="Sintaxis">Sintaxis</h2>
+
+<pre class="syntaxbox"><var>arr</var>.entries()</pre>
+
+<h3 id="Valor_de_retorno">Valor de retorno</h3>
+
+<p>Un nuevo objeto iterador {{jsxref("Array")}}.</p>
+
+<h2 id="Ejemplos">Ejemplos</h2>
+
+<h3 id="Usando_un_bucle_for…of">Usando un bucle <a href="/es/docs/Web/JavaScript/Reference/Statements/for...of">for…of</a> </h3>
+
+<pre class="brush: js">var a = ['a', 'b', 'c'];
+var iterator = a.entries();
+
+for (let e of iterator) {
+ console.log(e);
+}
+// [0, 'a']
+// [1, 'b']
+// [2, 'c']</pre>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificación</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentarios</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.entries', 'Array.prototype.entries')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Definición inicial.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.entries', 'Array.prototype.entries')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_con_navegadores">Compatibilidad con navegadores</h2>
+
+<div>
+<p>{{Compat("javascript.builtins.Array.entries")}}</p>
+</div>
+
+<div id="compat-mobile"> </div>
+
+<h2 id="Ver_también">Ver también</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.keys()")}}</li>
+ <li>{{jsxref("Array.prototype.values()")}}</li>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+ <li><a href="/es/docs/Web/JavaScript/Reference/Statements/for...of">for...of</a></li>
+ <li><a href="/es/docs/Web/JavaScript/Reference/Iteration_protocols">Protocolos de iteración</a></li>
+</ul>