I can recover my api but I cannot recover firstname in my object people, do you have a solution?
here my code for select l'object people :
console.log(data['people']);
and i want select firstname in my object people
I can recover my api but I cannot recover firstname in my object people, do you have a solution?
here my code for select l'object people :
console.log(data['people']);
and i want select firstname in my object people
Your people object is an array so, to get the firstname value you need to either loop in this array (with foreach or map) and then use .firstname, or you can just specify an entry
so you can do :
data['people'][0].firstname
or
data['people'].forEach(element => {
element.firstname
});
can you loop the array by using map.
data['people'].map((item, index) => {
console.log(item.firstname)
})