Accessing Object Properties with Dot Notation

Accessing Object Properties with Dot Notation
0.0 0


// 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


What is your question?


If you know the name of an object property you can access that value one of two ways. Dot notation or bracket notation. The test is to change the bracket notation to dot notation.

const person = {name:"Bob", job:"Secret Agent"};

//both of these will work
console.log(;  //  Bob ( . dot notation)
console.log(person["name"]);  //  Bob ( [] bracket notation)


I was wondering whether my good was solid or not…thanks for your concern !


Use " ,instead of “ . Wrong characters.