Who's in your Bracket?


#1


Don't know What I'm doing wrong


https://www.codecademy.com/courses/objects-ii/0/5?curriculum_id=506324b3a7dffd00020bf661#


var james = {
    job: "programmer",
    married: false
};

// set to the first property name of "james"
var aProperty = james["job"];

// print the value of the first property of "james" 
// using the variable "aProperty"
console.log(aProperty);


#2

That would be,

 ... = "job"

#3

Don't believe I understand your suggestion. The property (variable of the object) is already named job. So I still tried follow your recommendation and it didn't help. This is what my code looks like now
james = {
job: "job",
married: false
};

// set to the first property name of "james"
var aProperty = james["job"];

// print the value of the first property of "james"
// using the variable "aProperty"
console.log(aProperty);


#4

Thank you for the input. I got it. They wanted me to access the object variable by using the bracket notation in which I was to use a variable 'aProperty' with the value "job" so -> james[aProperty] where aProperty = "job". instead on james["job"]. Correct code:
var james = {
job: "programmer",
married: false
};

// set to the first property name of "james"
var aProperty = "job";

// print the value of the first property of "james"
// using the variable "aProperty"
console.log(james[aProperty]);


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.