Who's in Your Bracket? - Introduction to Objects II


#1

I am getting the correct answer but I am not able to pass the test. Does anyone know why the way I wrote the code is not working but another way works despite getting the same result?

Here is the way that allows me to pass on to the next challenge:

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]);

Here is the code that doesn't let me pass but gives the same answer. Does anyone know what the problem is, is it my code, is the Codecademy?

Thanks!

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

Nevermind = I found the answer here!


#3

Thanks a bunch! I don't know why it was so confusing at first but that really helped!


#4

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