Discovering the technique to retrieve property values.
Given the following:
let object1 = [{name: "HappyHands31"}, {job: "website developer"}, {city: "Chicago"}];
How can I output only the value of the second object, which is "website developer"?
I am familiar with how to display the entire key-value pair (or object) using .find()
:
let object1 = [{name: "HappyHands31"}, {job: "website developer"}, {city: "Chicago"}];
console.log(object1.find(function(element) {
return element.hasOwnProperty("job");
}
));
However, how do we specifically access just the value associated with this pair?