To filter array of objects based on another array in JavaScript, we call the includes method.
For instance, we write
const filtered = people.filter((person) => idFilter.includes(person.id));
to call people.filter with a callback that calls idFilter.includes to check if person.id is included in the idFilter array.
Then an array with the objects that have id property included in the idFilter array is included.