diff options
| author | julieng <julien.gattelier@gmail.com> | 2021-08-03 08:03:09 +0200 |
|---|---|---|
| committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-09-03 08:08:25 +0200 |
| commit | 844f5103992238c0c23203286dad16a466e89c97 (patch) | |
| tree | d537708951bb2b61be8192ffacc05a0ce6804f89 /files/fr/web/javascript/reference/global_objects/array/keys/index.html | |
| parent | a70fd5b73ecb10bec3906640023e2a1a46e118a2 (diff) | |
| download | translated-content-844f5103992238c0c23203286dad16a466e89c97.tar.gz translated-content-844f5103992238c0c23203286dad16a466e89c97.tar.bz2 translated-content-844f5103992238c0c23203286dad16a466e89c97.zip | |
move *.html to *.md
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/array/keys/index.html')
| -rw-r--r-- | files/fr/web/javascript/reference/global_objects/array/keys/index.html | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/array/keys/index.html b/files/fr/web/javascript/reference/global_objects/array/keys/index.html deleted file mode 100644 index 88e747da9c..0000000000 --- a/files/fr/web/javascript/reference/global_objects/array/keys/index.html +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: Array.prototype.keys() -slug: Web/JavaScript/Reference/Global_Objects/Array/keys -tags: - - Array - - ECMAScript 2015 - - Iterator - - JavaScript - - Méthode - - Prototype - - Reference -translation_of: Web/JavaScript/Reference/Global_Objects/Array/keys -original_slug: Web/JavaScript/Reference/Objets_globaux/Array/keys ---- -<div>{{JSRef}}</div> - -<p>La méthode <code><strong>keys()</strong></code> renvoie un nouvel objet <code><strong>Array Iterator</strong></code> qui contient les clefs pour chaque indice du tableau.</p> - -<div>{{EmbedInteractiveExample("pages/js/array-keys.html")}}</div> - -<h2 id="Syntaxe">Syntaxe</h2> - -<pre class="syntaxbox"><var>arr</var>.keys()</pre> - -<h3 id="Valeur_de_retour">Valeur de retour</h3> - -<p>Un nouvel objet itérateur pour {{jsxref("Array")}}.</p> - -<h2 id="Exemples">Exemples</h2> - -<h3 id="Utilisation_simple">Utilisation simple</h3> - -<pre class="brush:js">var arr = ["a","b","c"]; -var itérateur = arr.keys(); - -console.log(itérateur.next()); // { value: 0, done: false } -console.log(itérateur.next()); // { value: 1, done: false } -console.log(itérateur.next()); // { value: 2, done: false } -console.log(itérateur.next()); // { value: undefined, done: true } -</pre> - -<h3 id="Un_itérateur_de_clés_prend_en_compte_les_trous">Un itérateur de clés prend en compte les trous</h3> - -<pre class="brush: js">var arr = ["a", , "c"]; -var clésCreuses = Object.keys(arr); -var clésDenses = [...arr.keys()]; -console.log(clésCreuses); // ["0", "2"] -console.log(clésDenses); // [0, 1, 2]</pre> - -<h2 id="Spécifications">Spécifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Spécification</th> - <th scope="col">État</th> - <th scope="col">Commentaires</th> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-array.prototype.keys', 'Array.prototype.keys')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Définition initiale.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-array.prototype.keys', 'Array.prototype.keys')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("javascript.builtins.Array.keys")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>{{jsxref("Array.prototype.entries()")}}</li> - <li>{{jsxref("Array.prototype.values()")}}</li> - <li><a href="/fr/docs/Web/JavaScript/Reference/Les_protocoles_iteration">Les protocoles d'itération</a></li> -</ul> |
