-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
46 lines (41 loc) · 1.15 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const poems = [
{
author: "Cece",
poem: "Roses are red \n Violets are blue \n Sunflowers are yellow \n I bet you were expecting something romantic but no -- these are just gardening facts.",
image: "sunflower.jpeg",
},
{
author: "Anvit",
poem: "Roses are red \n Pizza sauce is too \n I ordered a large \n None of it is for you ",
image: "pizza.jpeg",
},
{
author: "Ernie",
poem: "Roses are red \n Violets are blue \n Jerry Seinfeld is considering \n Making Bee Movie 2",
image: "bee.jpeg",
},
{
author: "Davide",
poem: "Questo e un poema \n per Jenny \n ragazza viaggiatrice \n molto figa ",
image: "jennyIrish.jpeg",
},
];
let displayPoems = (array) => {
let html = "";
let poemDiv = document.getElementById("poems");
poemArray = array.forEach((poem) => {
html += `
<div class="poem">
<img class="poem__image" src="./assets/${poem.image}"/>
<div class="poem__author">
Author: ${poem.author}
</div>
<div class="poem__content">
${poem.poem}
</div>
</div>
`;
});
poemDiv.innerHTML = html;
};
displayPoems(poems);