Who's in your bracket?



The followoing error occurs: Oops, try again. It looks like james' job was not logged to the console.

I am aware there is already another thread (https://discuss.codecademy.com/t/5-whos-in-your-bracket/75870/4), concerning this problem, but it is already closed and somehow the solution ( adding the line: james[aProperty]; ) will not work.

I also seem not to understand the whole idea of this dot notation vs. bracket notation.

To get the value of first property of the Object james using the dot notation I would use:
Using the bracket notation i would write:

If I now create a variable with the String job I can use this variable, to get the value of the property job of the object james. In this example the variable aProperty is created. (I personally don't understand what is the advantage of having a variable instead of writing a string into the bracket notation...) Using this variable would look like this:

What am I doing wrong or missunderstanding? :weary:

Thanks already for any help/comments!


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"



ok apparently the other thread was not closed, and I just saw, that there is a bug and all I had to do was to refresh the page... so the code is correct...


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