summaryrefslogtreecommitdiffhomepage
path: root/fr-fr
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2020-08-20 01:19:27 -0700
committerGitHub <noreply@github.com>2020-08-20 01:19:27 -0700
commit33282ebaa2070ff8df96d2476ed211d7f46eb969 (patch)
treec40c0f622230e8ce031cdf0dc74a465a839bb108 /fr-fr
parent3aba6767edaa2c11a1dee5c107dbb6ecba555191 (diff)
parentc4175c9f62d0aba25d619b4ec09307c4b8abd27a (diff)
Merge pull request #3997 from kevinnls/fix-js_fr-forLoop
[js/fr] fix for...of loop
Diffstat (limited to 'fr-fr')
-rw-r--r--fr-fr/javascript-fr.html.markdown22
1 files changed, 12 insertions, 10 deletions
diff --git a/fr-fr/javascript-fr.html.markdown b/fr-fr/javascript-fr.html.markdown
index 7aad2da8..186859ab 100644
--- a/fr-fr/javascript-fr.html.markdown
+++ b/fr-fr/javascript-fr.html.markdown
@@ -1,12 +1,12 @@
---
language: javascript
contributors:
- - ['Leigh Brenecki', 'https://leigh.net.au']
- - ['Ariel Krakowski', 'http://www.learneroo.com']
+ - ["Leigh Brenecki", "https://leigh.net.au"]
+ - ["Ariel Krakowski", "http://www.learneroo.com"]
filename: javascript-fr.js
translators:
- - ['@nbrugneaux', 'https://nicolasbrugneaux.me']
- - ['Michel Antoine', 'https://github.com/antoin-m']
+ - ["@nbrugneaux", "https://nicolasbrugneaux.me"]
+ - ["Michel Antoine", "https://github.com/antoin-m"]
lang: fr-fr
---
@@ -328,13 +328,15 @@ for (var x in person){
}
description; // = "Paul Ken 18 "
-// *ES6:* La boucle for...of permet d'itérer sur les propriétés d'un objet
-var description = "";
-var person = {fname:"Paul", lname:"Ken", age:18};
-for (var x of person){
- description += x + " ";
+// *ES6:* La boucle for...of permet de parcourir un objet itérable
+// (ce qui inclut les objets Array, Map, Set, String, ... Mais pas un objet littéral !)
+let myPets = "";
+const pets = ["cat", "dog", "hamster", "hedgehog"];
+for (let pet of pets){ //`(const pet of pets)` est également possible
+
+ myPets += pet + " ";
}
-description; // = "Paul Ken 18 "
+myPets; // = 'cat dog hamster hedgehog '
// && est le "et" logique, || est le "ou" logique
if (house.size === 'big' && house.colour === 'blue'){