Nothing works!


#1

var james = {
job: "programmer",
married: false
};

// set to the first property name of "james"
james.job="Analist";
james.job = "developer";
james["job"]="Developer";
// print the value of the first property of "james"
// using the variable "aProperty"
console.log (james["job"]);
console.log(james.job);
console.log([james.job]);


#2

What is it supposed to do and what does it do instead?


#3

5. Who's in Your Bracket?

Instructions
Take advantage of the ability to use variables with bracket notation.

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.


#4

Who's in Your Bracket?
And finally, let's go over retrieving property values.
Throughout this section, we've been using dot notation to get the value of an object's property:someObj.propName;

However, remember that we can also use bracket notation:someObj["propName"];
An advantage of bracket notation is that we are not restricted to just using strings in the brackets. We can also use variables whose values are property names:
var someObj = {propName: someValue};
var myProperty = "propName";
someObj[myProperty];

The last line is exactly the same as using someObj["propName"];.InstructionsTake advantage of the ability to use variables with bracket notation.In line 7, set aProperty to a string of the first property in james (ie. the jobproperty).Then print james's job using bracket notation and aProperty.?Stuck? Get a hint!Get live, fast support from Codecademy Advisors when you get stuck.Learn more.What are the properties of james? SetaProperty to be the name (not value!) of the first property (in order as they are defined in the code) of james.aProperty should be a String. Recall that Strings are essentially "text surrounded by quotes". We want our text here to be the name of james's first property.You should then use console.log to print.


#5

ERROR That it printout

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