object.html
768 Bytes
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>how to make object</h1>
<script>
var coworkers = {
"designer":"minsung",
"programmer":"sdy"
};
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>
</body>
</html>