Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const recipes = [
- {
- name: "Pizza",
- ingredients:["dough", "tomato sauce", "cheese", "toppings"
- },
- {
- name: "Tacos",
- ingredients: ["tortillas", "ground beef", "cheese", "lettuce", "salsa"]
- }
- ];
- const recipesList = document.getElementById("recipe-list");
- for let i = 0; i < recipes.length; i++) {
- let recipe = recipes[i]
- let recipeEl = document.createElement("div");
- recipeEl.innerHTML = `<h2>${recipe.name}</h2><ul>`;
- for let j = 0; j < recipe.ingredients.length; j++) {
- let ingredient = recipe.ingredients[j];
- recipeEl.innerHTML += `<li>${ingredient}</li>`;
- }
- recipeEl.innerHTML += `</ul>`;
- recipesList.appendChild(recipeEl);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement