5. Who's in your brackets?


#1

I have already finished the course but cannot figure out what's wrong with this piece of code. I've come to the point in which I'm already "blind" for reading the code or it's a codecademy's bug (since I've tested it on my node console).

Anyways, what's wrong with the code bellow? It simply does not print the job!

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

It does print "programmer" on my end


#3

That's really weird. It works fine on my node console too. Must be a bug then. I'll have to leave it unfinished on my home page till they fix it.

Thanks for your time.


#4

Aah try another browser perhaps? I think it runs in your browser for JS (most other tracks send off code to a server)


#5

Just tried another time, you know... just in case. Opened the task and simply clicked on "Save and Submit". Guess what? It worked. Haha
Someone must have seen this topic and fixed it. Hahaha I'm like trying the same thing over and over for three days and now it works. Hahaha
Anyways... Thanks again!


#6

I had issues too. Code looked perfect and I would get an error. Refreshed the page and clicked save/submit and it worked!


#7

I wish I'd have your luck. I'm stuck again in another course and none of these 'reset like' solutions' are working.


#8

NOT TO BRAG OR ANYTHING but things have to be very very messed up for me not to be able to figure out how to get around it when it comes to these exercises (been around for a while). Tell me about it?
The code, what you expect, what happens, and a link to the exercise


#9

There is nothing wrong with your code. I have the exact same code. I copy & pasted your code into my computer, and it worked with no problems.

After I entered your code this is the result: programmer


#11

Don't be so quick to blame one thing or another without testing it. No, that's something that'll happen when pixels are counted in the result of html documents.


#12

Got confused between topics. Thought it was another one about the HTML & CSS course.


#13

Got the same bug, reloading in a new tab seemed to fix it for me too, might've just needed a refresh.


#14

I got the same error while using safari, switched to chrome and it worked just fine.


#15

Poorly worded instructions, I could not understand what to do in this exercise. And this is not the exact wording of the instructions is not only for this exercise!


#16

Thank you! I came to look at this post so I could figure out what I was supposed to be doing! Glad I'm not alone...


#17

Same issue. I have the same code as you, and couldn't figure out what is wrong. Edit: just refreshed my browser and voila, it worked this time.


#18

try to copy this code 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]);


#19

This shouldn't work actually, although it does... right?


#20

I did this to bypass the issue and move on to next practice.
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"
var test = james[aProperty];
console.log(test);


#21

can we set value of aProperty to "job" via accessing a property of james, not just giving away a string "job"?