Learning from Codecademy. I have to get property of an object to a variable( not property value). This is messing with my brain from an hour.
Here is the code (I messed up a bit to find solution. Please use comments understand it correctly. I am confused to ask) SCREENSHOT: http://prntscr.com/bcj94x
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"
console.log(james["job"]);
console.log(aProperty);
I am getting: this in the console when run the script
programmer
programmer
Thanks
'job'toaProperty? And then doconsole.log(james[aProperty]);console.log(aProperty);and get results'job''programmer'correspondingly?