I'm encountering some difficulties while filtering an array of objects based on a specific set of values:
Here is the array that needs to be filtered:
const items: Product[] = ... values
Next, I have created an array containing the products that I wish to select:
const sel: Product[] = ... values
The property that I need to use for applying the filter is idProduct. How can I achieve this?
I am looking for something along the lines of:
const query = items.filter(item => sel.map(s => s.idProduct).includes(item.idProduct))
Any ideas on how to make this work?
Appreciate your assistance.