5.Who's in your bracket?

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

1 Like

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);
2 Likes

tried that …it’s showing the same error!!

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

4 Likes

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.

1 Like

…mine didn’t need a space? But glad you got it to work!

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

5 Likes

disabling adblock allows the code to run

4 Likes

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

2 Likes

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

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

6 Likes

Same thing happened to me.

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

1 Like

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.

I tried refreshing multiple times, still the issue persists.

Refreshing the page works!

1 Like

thats also not following codecademy form also

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

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

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

2 Likes

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

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