I have an array of 10 users, I want to filter the users based on the 'intresses' (that means interests in dutch) array within the users. So for example I want to filter all the users that have the interests 'Afrika' (like index 2).
This is what I tried but it will give me an empty array back.
var newArray = gesorteerdeMatchPercentages.filter((el) => {
el.intresses.forEach((item) => {
return item.naam === "Afrika";
});
});
console.log("new", newArray);

===? There is no reason whatsoever for you to do use===in the type of code you're writing.item.naambut the screenshot shows the property is namedIntresse_naam. You'll probably want to use a regex as well since that data seems to be somewhat sketchy, e.g., at least one value includes escaped characters.forEachdoes nothing w/ return values; you need to return something fromfilter.