-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
50 lines (46 loc) · 1.3 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
47
48
49
50
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: "Genesis111",
poem: "Roses are red \n Violets are blue \n Duck is using phone \n That looks like you",
image: "duck.jpeg",
},
{
author: "Kuanze",
poem: "Roses are not red \n Violets are blue \n Duck is using phone \n That looks like you",
image: "bee.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);