Hi I am 99% there with the code below but I need this array of objects to return:- 'Bear', 'Minu', 'Basil', 'Hamish' instead it returns Bear,MinuBasil,Hamish any ideas?
gatherPets([{ name: 'Malcolm', pets: ['Bear', 'Minu'] },{ name: 'Caroline', pets: ['Basil',
'Hamish'] },]);
function gatherPets(people) {
let newArray=[];
for (let i=0; i <=people.length; i++ ) {
newArray = newArray +people[i].pets
}
return (newArray)
}