--- id: 587d7dac367417b2b2512b74 title: Use Dot Notation to Access the Properties of an Object challengeType: 1 videoUrl: '' localeTitle: 使用点表示法访问对象的属性 --- ## Description
最后一个挑战创建了一个具有各种propertiesobject ,现在您将看到如何访问这些properties的值。这是一个例子:
让duck = {
名称:“Aflac”,
numLegs:2
};
的console.log(duck.name);
//这会将“Aflac”打印到控制台
点符号用于object名称duck ,后跟property name ,以访问“Aflac”的值。
## Instructions
将以下dog对象的两个properties打印到控制台。
## Tests
```yml tests: - text: 您应该使用console.log来打印dog对象的name属性的值。 testString: 'assert(/console.log\(.*dog\.name.*\)/g.test(code), "Your should use console.log to print the value for the name property of the dog object.");' - text: 您应该使用console.log来打印dog对象的numLegs属性的值。 testString: 'assert(/console.log\(.*dog\.numLegs.*\)/g.test(code), "Your should use console.log to print the value for the numLegs property of the dog object.");' ```
## Challenge Seed
```js let dog = { name: "Spot", numLegs: 4 }; // Add your code below this line ```
## Solution
```js // solution required ```