diff options
author | kevinnls <57634663+kevinnls@users.noreply.github.com> | 2020-08-16 12:10:15 +0530 |
---|---|---|
committer | kevinnls <57634663+kevinnls@users.noreply.github.com> | 2020-08-20 13:09:53 +0530 |
commit | f92694aac9c1b84d06455e728d76fa339eddc312 (patch) | |
tree | 27df9baf9ee0667ddd7c86e8a5c41a72f817415e | |
parent | 3aba6767edaa2c11a1dee5c107dbb6ecba555191 (diff) |
[js/fr] fix for...of loop
Co-authored-by: Carl20cent <carl.vincent38@gmail.com>
bump changed section variable declarations to ES6
Update fr-fr/javascript-fr.html.markdown
-rw-r--r-- | fr-fr/javascript-fr.html.markdown | 22 |
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..fa9ffa04 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)` is also 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'){ |