5.Who's in your bracket?


#1

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

I'm getting the following error:
"Oops, try again. It looks like james' job was not logged to the console."


#2

You're literally setting aProperty to be equal to the string "job"

What you want is to set it to the value for the job property in james.

var myVariable = myObject.itsProperty;

and then you can simply log

console.log(myVariable);

#3

tried that ....it's showing the same error!!


#4

ok i finally solved it.......i just forgot to apply a space between "job" and the semicolon while assigning its value to aProperty!.....Damn codeacademy!


#5

Okay... thought maybe it was trying to make you do it a different way. Original code seems like it should work too...

Is the page stuck? Try refreshing, maybe.


#6

...mine didn't need a space? But glad you got it to work!


#7

I was having the same issue, refreshed and it worked just fine. Weird.


#8

disabling adblock allows the code to run


#9

I had the same issue and found that just like with hmalloy1981 I had to refresh the page.


#10

First you have to define first propriety of "james".
var aProperty = "job";

Then you print it using the variable "aProperty".
console.log(james[aProperty]);


#11

Same thing happened to me.


#12

Same here. I had to refresh the page too.. and I spent like 2 hours looking for errors...


#13

Yup, same thing happened to me. Had to refresh the page in order for it to run.

I swear, Codecademy's console is straight up broken sometimes.


#14

I tried refreshing multiple times, still the issue persists.


#15

Refreshing the page works!


#16

thats also not following codecademy form also


#17

This is the one that worked for me....I was brain farting by this point appreciate the help :smiley:


#18

Can anyone explain to me why this is useful in the slightest? Why not just print james.job?


#19

I just refrash and try again, then 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"
console.log(james[aProperty]);


#20

same here. refresh and go on. no mistake here.

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