diff options
author | hra <hamid.alipour@live.com> | 2018-07-01 15:05:02 -0700 |
---|---|---|
committer | hra <hamid.alipour@live.com> | 2018-07-01 15:05:02 -0700 |
commit | faca0e79445f90e51acc4c4345795de6ae69c9ab (patch) | |
tree | 0b9ea2dec88f76971b530cbf227992150ae1d201 /javascript.html.markdown | |
parent | 8612e00b9f26feafcb531609f0ab0ec61ea06dd0 (diff) |
add for/of to js
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r-- | javascript.html.markdown | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown index 85c8a52d..f2dd08c8 100644 --- a/javascript.html.markdown +++ b/javascript.html.markdown @@ -248,6 +248,13 @@ for (var x in person){ description += person[x] + " "; } // description = 'Paul Ken 18 ' +// The for/of statement allows iteration over an iterator. +var myPets = ""; +var pets = ["cat", "dog", "hamster", "hedgehog"]; +for (var pet of pets){ + myPets += pet + " "; +} // myPets = 'cat dog hamster hedgehog ' + // && is logical and, || is logical or if (house.size == "big" && house.colour == "blue"){ house.contains = "bear"; |