5. Who's in your bracket?


#1

I don't see what could be wrong in my code but I get the error: "It looks like james' job was not logged to the console.

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


#2

The first property of the james object is not called aProperty, what do you think you should be referring to? If they want you to change the first property of james


#3

I named "aProperty" after the first one in the object, and I've also tried to log the job directly.

This is what I should do: "In line 7, set aProperty to a string of the first property in james (ie. the job property). Then print james's job using bracket notation and aProperty.".


#4

I added this new line in the code and apparently it works.

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"
james[aProperty]; //this is the new line
console.log(james[aProperty]);

Who's in your bracket?
#5

That is what I meant, but it's okay it was your creative thing as well that helped you solve the problem. :slight_smile:


#7

Your code was fine the first time around, for some reason exercise 5 has a bug where the console won't print.

You just have to refresh the page.
Another poster made this same thing.


#8

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