Accessing Object Properties with Dot Notation
Summary
- To access properties of an object, either dot notation (
.
) or bracket notation ([]
) can be used. - Dot notation is used when the name of ther property is known and does not uses psaces.
Final Code
// Setup
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