Is there a built in Javascript function or library to do the following:
const data = [
{ name: 'name1', type: 'type1' },
{ name: 'name2', type: 'type2' },
{ name: 'name3', type: 'type3' },
{ name: 'name4', type: 'type2' },
];
To search the following and return all objects where type = 'type2'
Something similar to data.findIndex((i) => i.type === 'type2')
but returns all matches rather than first index?
Thanks