-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex10.html
38 lines (38 loc) · 1.02 KB
/
ex10.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Object</h1>
<h2>Create</h2>
<script>
var coworkers = {
"programmer":"egoing",
"designer":"leezche"
};
document.write("programmer : " + coworkers.programmer + "<br>");
document.write("designer : " + coworkers.designer + "<br>");
coworkers.bookkeeper = "duru";
document.write("bookkeeper : " + coworkers.bookkeeper + "<br>");
coworkers["data scientist"] = "taeho";
document.write("data scientist : " + coworkers["data scientist"] + "<br>");
</script>
<h2>Iterate</h2>
<script>
for(var key in coworkers) {
document.write(key+' : '+coworkers[key] + '<br>');
}
</script>
<h2>Property & Method</h2>
<script>
coworkers.showAll = function() {
for(var key in this) {
document.write(key+' : '+this[key] + '<br>');
}
}
coworkers.showAll();
</script>
</body>
</html>