3 ms·
"tech stack" function searchRecipes() { const input = document.getElementById('searchInput').value.toLowerCase(); const filteredRecipes = recipes
by KomoD 3y ago
"tech stack"
function searchRecipes() {
const input = document.getElementById('searchInput').value.toLowerCase();
const filteredRecipes = recipes.filter(recipe =>
recipe.ingredients.some(ingredient =>
ingredient.toLowerCase().includes(input)
)
);
displayResults(filteredRecipes);
}
recipes is an array of objects like this:
{
name: "Ginger Tofu Stir-Fry",
ingredients: ["Tofu", "Broccoli", "Bell peppers", "Ginger", "Garlic", "Soy sauce", "Scallions", "Sesame oil", "Rice vinegar"],
instructions: "Stir-fry tofu with broccoli, bell peppers, ginger, and garlic. Add soy sauce, sesame oil, and rice vinegar. Garnish with scallions."
}
- brunooliv 3y agoThe idea truly was basic simplicity here