summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r--javascript.html.markdown7
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";