I've been struggling with this function for two days and still can't get it right. I need the function to only return objects that meet all filter criteria in the array. The issue is that it should only return objects that satisfy every filter.
Here are my filters:
const myFiltersIngredients = ['flour', 'chicken']
And here are the objects in my array:
const myRecipes = [
{
name: 'grandma's pie',
ingredients: [
{
ingredient: 'flour',
ingredientUnit: 'grams',
ingredientQuantity: 500
},
{
ingredient: 'chicken',
ingredientUnit: 'grams',
ingredientQuantity: 500
}
]
},
{
name: 'cookie',
ingredients: [
{
ingredient: 'flour',
ingredientUnit: 'grams',
ingredientQuantity: 500
},
{
ingredient: 'butter',
ingredientUnit: 'grams',
ingredientQuantity: 500
}
]
}
]