From 844f5103992238c0c23203286dad16a466e89c97 Mon Sep 17 00:00:00 2001 From: julieng Date: Tue, 3 Aug 2021 08:03:09 +0200 Subject: move *.html to *.md --- .../global_objects/array/@@iterator/index.html | 89 ---------------------- .../global_objects/array/@@iterator/index.md | 89 ++++++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 files/fr/web/javascript/reference/global_objects/array/@@iterator/index.html create mode 100644 files/fr/web/javascript/reference/global_objects/array/@@iterator/index.md (limited to 'files/fr/web/javascript/reference/global_objects/array/@@iterator') diff --git a/files/fr/web/javascript/reference/global_objects/array/@@iterator/index.html b/files/fr/web/javascript/reference/global_objects/array/@@iterator/index.html deleted file mode 100644 index 44665dcba8..0000000000 --- a/files/fr/web/javascript/reference/global_objects/array/@@iterator/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: Array.prototype[@@iterator]() -slug: Web/JavaScript/Reference/Global_Objects/Array/@@iterator -tags: - - Array - - ECMAScript 2015 - - Iterator - - JavaScript - - Méthode - - Prototype - - Reference -translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@iterator -original_slug: Web/JavaScript/Reference/Objets_globaux/Array/@@iterator ---- -
{{JSRef}}
- -

La valeur initiale de la propriété @@iterator correspond à la valeur initiale fournie par l'itérateur {{jsxref("Array.prototype.values()", "values")}}.

- -

Syntaxe

- -
arr[Symbol.iterator]()
- -

Valeur de retour

- -

La première valeur fournie par {{jsxref("Array.prototype.values()","values()")}}. Si on utilise arr[Symbol.iterator] (sans les parenthèses) le navigateur renverra par défaut la fonction {{jsxref("Array.prototype.values()", "values()")}}.

- -

Exemples

- -

Parcourir un tableau avec une boucle for...of

- -
var arr = ['w', 'y', 'k', 'o', 'p'];
-var eArr  = arr[Symbol.iterator]();
-// il est nécessaire que l'environnement supporte
-// les boucles for..of et les variables
-// utilisées avec let ou const ou var
-for (let letter of eArr) {
-  console.log(letter);
-}
-
- -

Parcourir un tableau avec next

- -
var arr = ['w', 'y', 'k', 'o', 'p'];
-var eArr = arr[Symbol.iterator]();
-console.log(eArr.next().value); // w
-console.log(eArr.next().value); // y
-console.log(eArr.next().value); // k
-console.log(eArr.next().value); // o
-console.log(eArr.next().value); // p
-
- -

Spécifications

- - - - - - - - - - - - - - - - - - - - - -
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}}{{Spec2('ESDraft')}} 
- -

Compatibilité des navigateurs

- -

{{Compat("javascript.builtins.Array.@@iterator")}}

- -

Voir aussi

- - diff --git a/files/fr/web/javascript/reference/global_objects/array/@@iterator/index.md b/files/fr/web/javascript/reference/global_objects/array/@@iterator/index.md new file mode 100644 index 0000000000..44665dcba8 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/array/@@iterator/index.md @@ -0,0 +1,89 @@ +--- +title: Array.prototype[@@iterator]() +slug: Web/JavaScript/Reference/Global_Objects/Array/@@iterator +tags: + - Array + - ECMAScript 2015 + - Iterator + - JavaScript + - Méthode + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@iterator +original_slug: Web/JavaScript/Reference/Objets_globaux/Array/@@iterator +--- +
{{JSRef}}
+ +

La valeur initiale de la propriété @@iterator correspond à la valeur initiale fournie par l'itérateur {{jsxref("Array.prototype.values()", "values")}}.

+ +

Syntaxe

+ +
arr[Symbol.iterator]()
+ +

Valeur de retour

+ +

La première valeur fournie par {{jsxref("Array.prototype.values()","values()")}}. Si on utilise arr[Symbol.iterator] (sans les parenthèses) le navigateur renverra par défaut la fonction {{jsxref("Array.prototype.values()", "values()")}}.

+ +

Exemples

+ +

Parcourir un tableau avec une boucle for...of

+ +
var arr = ['w', 'y', 'k', 'o', 'p'];
+var eArr  = arr[Symbol.iterator]();
+// il est nécessaire que l'environnement supporte
+// les boucles for..of et les variables
+// utilisées avec let ou const ou var
+for (let letter of eArr) {
+  console.log(letter);
+}
+
+ +

Parcourir un tableau avec next

+ +
var arr = ['w', 'y', 'k', 'o', 'p'];
+var eArr = arr[Symbol.iterator]();
+console.log(eArr.next().value); // w
+console.log(eArr.next().value); // y
+console.log(eArr.next().value); // k
+console.log(eArr.next().value); // o
+console.log(eArr.next().value); // p
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ +

{{Compat("javascript.builtins.Array.@@iterator")}}

+ +

Voir aussi

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