Guest User

Untitled

a guest
Dec 11th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. const meals = [
  2. {
  3. id: 1,
  4. title: 'Strawberry Salad with Poppy Seed Dressing',
  5. img: 'Strawberry-Salad-with-Poppy-Seed-Dressing.jpg',
  6. book: 1,
  7. calories: 298,
  8. servings: 3,
  9. type: 'lunch',
  10. price: 15,
  11. cook: 'Jenny Jefferson',
  12. quantity: 10,
  13. },
  14. {
  15. id: 2,
  16. title: 'Cashew Turkey Salad Sandwiches',
  17. img: 'turkey-sandwich.jpg',
  18. book: 2,
  19. calories: 198,
  20. servings: 2,
  21. type: 'lunch',
  22. price: 9,
  23. cook: 'Jenny Jefferson',
  24. quantity: 10
  25. }];
  26.  
  27. function loadMeals() {
  28. let i = 0;
  29. let id = 1;
  30. let fillMealList = document.querySelector("#fillMealList");
  31. for (let i = 0; i < meals.length; i++) {
  32. let item = meals.find(item => item.id === id);
  33. fillMealList.innerHTML +=
  34. "<article>"+
  35. "<h3>" + item.title + "</h3>"+
  36. "<figure>"+
  37. "<img src='images/" + item.img + "'" +">" +
  38. "<figcaption>"+
  39. "Meal by: " +"<span>" + item.cook + "</span>" +
  40. "</figcaption>" +
  41. "</figure>"+
  42. "<div class='info'>"+
  43. "<p>€ <span>" + item.price + "</span>" + "/pp" + "</p>" +
  44. "<a href='#' class='addToCart'>Order</a>"+
  45. "</div>"+
  46. "</article>";
  47. id++;
  48. }
Add Comment
Please, Sign In to add comment