I have an array that stores user input and I have objects that require specific values to be true.The user input must match the ingredients in each object.
var recipes = [
{
'name': 'Omelette',
'ingredients': [
"Eggs",
"Mushrooms",
"Peppers",
"Onions"
]
},
{
'name': 'Spaghetti',
'ingredients': [
"Pasta",
"Tomato",
"Meat Balls"
]
};
var storedIngredients = [];
//This is the array that stores user input.
//I used this is so far but it's hardcoded and I don't want hardcode
if (storedIngredients.includes('Pasta','Tomato','Meat Balls') {
console.log(recipes.name[0];);
};
I need a way to have if the user enters the corresponding ingredients he will be shown that he has the ingredients to make spaghetti for example.