Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const meals = [
- {
- id: 1,
- title: 'Strawberry Salad with Poppy Seed Dressing',
- img: 'Strawberry-Salad-with-Poppy-Seed-Dressing.jpg',
- book: 1,
- calories: 298,
- servings: 3,
- type: 'lunch',
- price: 15,
- cook: 'Jenny Jefferson',
- quantity: 10,
- },
- {
- id: 2,
- title: 'Cashew Turkey Salad Sandwiches',
- img: 'turkey-sandwich.jpg',
- book: 2,
- calories: 198,
- servings: 2,
- type: 'lunch',
- price: 9,
- cook: 'Jenny Jefferson',
- quantity: 10
- }];
- function loadMeals() {
- let i = 0;
- let id = 1;
- let fillMealList = document.querySelector("#fillMealList");
- for (let i = 0; i < meals.length; i++) {
- let item = meals.find(item => item.id === id);
- fillMealList.innerHTML +=
- "<article>"+
- "<h3>" + item.title + "</h3>"+
- "<figure>"+
- "<img src='images/" + item.img + "'" +">" +
- "<figcaption>"+
- "Meal by: " +"<span>" + item.cook + "</span>" +
- "</figcaption>" +
- "</figure>"+
- "<div class='info'>"+
- "<p>€ <span>" + item.price + "</span>" + "/pp" + "</p>" +
- "<a href='#' class='addToCart'>Order</a>"+
- "</div>"+
- "</article>";
- id++;
- }
Add Comment
Please, Sign In to add comment