Who's in Your Bracket? - Looks like bug to me


The code prints out everything as it meant to, but gives an error:

"Oops, try again. Do you have the variable 'aProperty' between brackets?"

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"



"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."

So, this is tricky, because it seems like you have everything already to begin with. However, it specifically is wanting you to print james's job using bracket notation and aProperty. So bracket notation, using aProperty, and has to print jame's job...Noting all those elements, your aProperty should show up in your code like this:


And in fact, while james.job might work in other cases, you will get undefined by that in this case. You are taking the job property from var james above and printing that to the console therefore you should change james.job back to "job". Later on, when you get to lessons that deal with NYC (starting at 9.) Snoopy, (12.) and Penguins (16.) you will go more indepth into this.

Note: I, and others, have also experienced when putting in the correct code that it comes back as wrong but when you refresh or retry it comes out correct. For example: this discussion ---> https://discuss.codecademy.com/t/whos-in-your-bracket-5-30/70054


The code from the link you provided is working.
Just makes no sense for me - why write excess line.

P.S. Thanks, anyway.


Yeah, to be honest, I am not quite as sure either. I actually completed this lesson yesterday lol. That discussion that I posted clued me in on what the lesson was looking for specifically. I cannot really answer your question for sure, however, if I had a hunch, it may not be necessary to getting the actual answer but the goal is to learn a specific way of doing it rather than just getting the answer on the screen. But your welcome and I hope you enjoy the rest of Intro to Objects II! I know I am! :smiley:


I think it just wanted to show us the difference between the dot notation and bracket notation :slight_smile:

Really moving along in JS i see though!


Ok. That seems to be a logical conclusion and would make sense based on the learning process. And yeah! I finally decided to grind it out. I hate looking at 87% done all the time haha. I am on 19.) Black and White Penquin Magic now xD


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