Using object initializers
<html>
<head>
<title>Some Page</title>
</head>
<body>
<p>The following example creates myHonda with three properties.
Note that the engine property is also an object with its own
properties.</p>
<script>
var myHonda = {
color : "red",
wheels : 4,
engine : {
cylinders : 4,
size : 2.2
}
};
document.write(myHonda.engine.cylinders);
</script>
</body>
</html>
原文: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects?redirectlocale=en-US&redirectslug=JavaScript%2FGuide%2FWorking_with_Objects