It says that it isn't working, but I am doing what they are asking me to do!


#1



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


Codecademy, not the console, says: Do you have the variable 'aProperty' between brackets? However, the code is responding like they are asking it to.


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



var aProperty = james["job"]
console.log(aProperty)


#2

hm... i would be good if the exercise also accepts your solution since it is fine, but it is not, the exercise wants you to set aProperty to james first property, which is job:

var aProperty = "job"

and then use james[aProperty] to log james job to the console


#3

The exercise trying to show/teach you:

An advantage of bracket notation is that we are not restricted to just using strings in the brackets. [it is written in the exercise]

var aProperty = "job";

console.log(james[aProperty]);
So, in bracket notation you can write either james["a string inside"] or james[a variable of course without quotation]. Notice the difference:

james[aProperty] //No quotation mark " ", just a variable inside which is = "job".


#4

Hello! I'm getting error message saying

Oops, try again. It looks like james' job was not logged to the console.

But the code seems like supposed to be working

var james = {
job: "programmer",
married: false
};
var aProperty = "job";
console.log(james[aProperty]);


#5

Hi your code is right ..try to refresh the page,


#6

Thanks! I should have been guessing that :slight_smile: