Skip to content

Commit bb03be1

Browse files
committed
Displaying js object through loop
1 parent 9c21e1d commit bb03be1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<body>
5+
6+
<h2>JavaScript Display Object Properties</h2>
7+
8+
<p id="demo"></p>
9+
10+
<script>
11+
var x, txt = "";
12+
var person = { name: "Sanus", age: 50, city: "New York" };
13+
14+
for (x in person) {
15+
txt += person[x] + " ";
16+
};
17+
18+
document.getElementById("demo").innerHTML = txt;
19+
</script>
20+
</body>
21+
22+
</html>

0 commit comments

Comments
 (0)