Who's in your bracket? Need help!



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.


var james = {
job: “programmer”,
married: false

// set to the first property name of "james"
var aProperty =

// print the value of the first property of “james”
// using the variable “aProperty”


I have no idea what to do. "Set to a string of the first property"? My issue isnt terms, or syntaxes - it's the instructions. Can somebody explain them to me?
This is the Link to exersice


Hi @johncdf :smiley:
This one confused me a bit too, but what the instructions are asking you to do is set the first variable, aProperty, to the FIRST property in the james object.
And then use that variable for bracket notation: console.log(james["aProperty"]);

I hope this helps


Here some explanation…

james job married explained

- - - B a s i c s - - -

Each Object has one or more properties.
Each property consists of a property-key and it’s associated value.

 var object1 = {
              name: "First"

So object1 has 1 property with
a type property-key name
and it’s associated value “First” (which in this case is a “string-value”)

var myObj = {
         type: 'fancy',
         disposition: 'sunny'

myObj has 2 properties separated by a comma-,,
a property with property-key type and an associated-string-value 'fancy’
a disposition-property with property-key disposition and
…an associated-string-value ‘sunny’.

= = = = = = = = = = = = = = = = = = = = = = = = = = = =

var james = {
    job: "programmer",
   married: false,
   sayJob: function() {
          // complete this method
          console.log("Hi, I work as a" + this.job);

Description of the james object.
The james object has 3 properties which are separated by a comma-,

there is a job property with property-key job and it’s associated string value 'programmer’
there is a married property with property-key married and it’s associated boolean value false
there is a sayJob property with property-key sayJob and it’s associated anonymous function VALUE
( they also would ‘say’, the james-object has the sayJob()-Method )

##access via dot-notation
(no variable allowed, only literal property-key-name )

james.job ==> you will get the associated string VALUE of the job property-key, thus
you get the string VALUE ‘programmer’

james.married ==> you will get the associated boolean VALUE false

james.sayJob ==> you will get the associated anonymous function VALUE
to call/execute this method you add a pair of parenthesis-( )

##access via the square-bracket-notation
###1 using the literal property-key

###2 using the property-key by reference (=== via a variable )
var propertyKey1 = “job”;
var propertyKey2 = “married”;
var propertyKey3 = “sayJob”;
james[propertyKey1] ==> you will get the associated string VALUE of the job property-key, thus
you get the string “programmer”

in this case you will get the boolean VALUE of the married property
being false

would =display= “Hi, I work as a programmer”


Thank u so much. The question put up was confusing. U have made it simple while explaining


As an extra…

An object has one or more properties, separated by a comma_,

A property has a property-key and it’s associated VALUE

The VALUE can be anything from:

•Object  ◦Function/'Method'

and on the lookout for knowledge


google search
== the Book ==
javascript [your question] site:developer.mozilla.org

== discussions / opinions ==
javascript [your question] site:stackoverflow.com

== guidance ==
http://javascript.crockford.com/code.html <---JavaScript code-convention


Finally! It worked! Thanks for the explanation!:star_struck:


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