--- id: 56533eb9ac21ba0edf2244c7 title: Accessing Object Properties with Dot Notation challengeType: 1 videoUrl: '' localeTitle: Acessando propriedades de objeto com notação de ponto --- ## Description
Há duas maneiras de acessar as propriedades de um objeto: notação de ponto ( . ) E notação de colchetes ( [] ), semelhante a uma matriz. A notação de pontos é o que você usa quando sabe o nome da propriedade que está tentando acessar antecipadamente. Aqui está uma amostra de uso de notação de ponto ( . ) Para ler a propriedade de um objeto:
var myObj = {
prop1: "val1",
prop2: "val2"
};
var prop1val = myObj.prop1; // val1
var prop2val = myObj.prop2; // val2
## Instructions
Leia os valores de propriedade de testObj usando a notação de ponto. Defina a variável hatValue igual ao hat propriedade do objeto e defina a variável shirtValue igual à shirt propriedade do objeto.
## Tests
```yml tests: - text: hatValue deve ser uma string testString: 'assert(typeof hatValue === "string" , "hatValue should be a string");' - text: O valor de hatValue deve ser "ballcap" testString: 'assert(hatValue === "ballcap" , "The value of hatValue should be "ballcap"");' - text: shirtValue deve ser uma string testString: 'assert(typeof shirtValue === "string" , "shirtValue should be a string");' - text: O valor de shirtValue deve ser "jersey" testString: 'assert(shirtValue === "jersey" , "The value of shirtValue should be "jersey"");' - text: Você deve usar a notação de ponto duas vezes testString: 'assert(code.match(/testObj\.\w+/g).length > 1, "You should use dot notation twice");' ```
## Challenge Seed
```js // Setup var testObj = { "hat": "ballcap", "shirt": "jersey", "shoes": "cleats" }; // Only change code below this line var hatValue = testObj; // Change this line var shirtValue = testObj; // Change this line ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```