summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
authorJohn Gabriele <jgabriele@fastmail.fm>2018-09-10 02:05:03 -0400
committerJohn Gabriele <jgabriele@fastmail.fm>2018-09-10 02:05:03 -0400
commit3cfdf5777266d780a211cdad1c52755170097cc8 (patch)
tree8a269e1679f14ceac7a10c0592fa14bb947e5208 /javascript.html.markdown
parent60eac5d50054ddae92bd23fb51f3acc1c306a762 (diff)
parent6d087ae0f289e7013807639cbd609f991f968166 (diff)
Merge remote-tracking branch 'origin/master' into patch-1
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r--javascript.html.markdown9
1 files changed, 9 insertions, 0 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 52084e93..ecaf02c5 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -266,6 +266,15 @@ for (var x in person){
description += person[x] + " ";
} // description = 'Paul Ken 18 '
+// The for/of statement allows iteration over iterable objects (including the built-in String,
+// Array, e.g. the Array-like arguments or NodeList objects, TypedArray, Map and Set,
+// and user-defined iterables).
+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";