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


#1


https://www.codecademy.com/courses/objects-ii/0/5?curriculum_id=506324b3a7dffd00020bf661#


My code does exactly as it wants me to, but it says, "Oops, try again. Do you have the variable 'aProperty' between brackets?". I don't understand why I would need to put a variable between brackets.


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(aProperty);


#2

The brackets expected are index block type, as in square brackets. The array index access syntax is

object_identifier[property_name]

#3

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