I have the following object:
var people = [
{
"name": "James",
"work": "Shake Shack"
},
{
"name": "Stanley Hudson",
"work": "IBM"
}
]
Is there an easy way built into Javascript to allow me to get a list of values by their key?
For exemple if I want a list like ["Shake Shack", "IBM"]
, which is all the values in the array associated with the work
key, how can I do?
I know how to do this manually with a loop but I’d really like to know if there’s some built-in functionality in Javascript that could do this for me.