<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript object creating accessing</title>
</head>
<body>
<pre>
<script type="text/javascript">
var myObj = {}; // indicates an Object is created
myObj.commercial = ".com";
myObj.network= ".net";
myObj.organization= ".org";
myObj.government= ".gov";
document.writeln(myObj.length); // results still undefined
document.writeln("commercial domain: " + myObj['commercial']);
// Outputs .com
document.writeln("commercial domain: " + myObj.commercial);
// Outputs .com
</script>
</pre>
</body>
</html>