21 lines
440 B
Markdown
21 lines
440 B
Markdown
|
---
|
||
|
title: Accessing Object Properties with Dot Notation
|
||
|
localeTitle: 使用点表示法访问对象属性
|
||
|
---
|
||
|
## 使用点表示法访问对象属性
|
||
|
|
||
|
这是一个可能的解决方案:
|
||
|
|
||
|
```js
|
||
|
var testObj = {
|
||
|
"hat": "ballcap",
|
||
|
"shirt": "jersey",
|
||
|
"shoes": "cleats"
|
||
|
};
|
||
|
|
||
|
// Only change code below this line
|
||
|
|
||
|
var hatValue = testObj.hat; // Change this line
|
||
|
var shirtValue = testObj.shirt; // Change this line
|
||
|
|
||
|
```
|