summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
authorRaphael Nascimento <raphaelbn10@gmail.com>2015-10-06 20:51:47 -0300
committerRaphael Nascimento <raphaelbn10@gmail.com>2015-10-06 20:51:47 -0300
commitfe525731183779ef5b76cc714c47bd9033953e46 (patch)
treead97d4d5e116cd8bb5ead14d4a13dcd807c03ac2 /javascript.html.markdown
parent6ac7368b3b8e3ce1ee6c50c9f088553e7cbc6d1a (diff)
Update javascript.html.markdown
For/In loop JavaScript
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 ba2e8ce4..3308b08d 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -218,6 +218,13 @@ for (var i = 0; i < 5; i++){
// will run 5 times
}
+//The For/In statement loops through the properties of an object:
+var description = "";
+var person = {fname:"Paul", lname:"Ken", age:18};
+for (var x in person) {
+ description += person[x] + " ";
+}
+
// && is logical and, || is logical or
if (house.size == "big" && house.colour == "blue"){
house.contains = "bear";