I created a filter to retrieve the objects from an array. Made use of some of the object values but now I want to use the ids as an array not individually. I know pushing isn't right in this case and since I am still within the filter, how do I achieve this, please?
arrayList = [
{
id: 48589,
height: 5.8,
active: false
},
{
id: 84697,
height: 4.6,
active: true
},
{
id: 887697,
height: 5.0,
active: true
}
]
arrayList.filter(c => {
if(c.active){
//`I used the other values here
} else {
//Now I need c.id as an array to search my db
ids = [];
ids.push(c.id)
}
})