Playing around with arrays, I have not been successful trying to extract the value for a key. I think it would be console.log( variable name.key);
to return all of the keys. So I am expecting this array —
var people = [
{
name: 'Sara',
age: 25,
gender: 'f',
us: true
},
{
name: 'Mike',
age: 18,
gender: 'm',
us: false,
},
{
name: 'Peter',
age: 17,
gender: 'm',
us: false,
},
{
name: 'Ricky',
age: 27,
gender: 'm',
us: false,
},
{
name: 'Martha',
age: 20,
gender: 'f',
us: true
}
];
console.log( people.name );
to return all of the names for each object in the array. But that is not working. What am I missing?