Don't know what's wrong with my code


#1

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"
var aProperty = ‘job’;
console.log(“james”[“aProperty”]);

Error messages keeps saying;
Oops, try again. Do you have the variable ‘aProperty’ between brackets?


#2

Hey @april.mouwad
To put it simply, your code after the // set to the first property name of "james"
comment, it’s NOT asking you to use bracket notation yet to access the value. The first property is just “job”, so set that var aProperty to job.

Your next issue is the console.log statement, james is an object not a string value, so remove the “” and -> console.log(james[“aProperty”]);

Hope this helps!!!


#3

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