I have an array as following
array = [{ name: 'A' instructors: [ { name:'InsA' } ] businessUnit: {name:'myBusiness'}},{ name: 'B' instructors: [ { name:'InsB' } ] businessUnit: {name:'myBusinessB'}}]
I want to filter this array with the values i have which are also in an array as following
nameArr = [A,C,D]instructorArr = [InsA,InsC,InsZ]businessName = [myBusinessB,myBusinessX,myBusinessD]
If can filter this array if i have to check with just one value as following
const filtered = _.filter(groupActivityList, (obj) => { return ( obj.name === (groupClassFilter !== defaultFilter ? groupClassFilter : obj.name) && obj.instructors.length > 0 && obj.instructors[0]?.name === (groupInstructorFilter !== defaultFilter ? groupInstructorFilter : obj.instructors.length > 0 && obj.instructors[0]?.name) && obj.businessUnit.name === (groupFacilityFilter !== defaultFilter ? groupFacilityFilter : obj.businessUnit.name) ); });
How do i filter when i have a set of values to filter with Ex: nameArr = [A,C,D]