-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
43 lines (29 loc) · 1000 Bytes
/
Copy pathscript.js
File metadata and controls
43 lines (29 loc) · 1000 Bytes
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
const posts = [
{
text: "Diablo IV",
content: "Diablo 4 é o mais novo RPG de ação que chega agora em abril",
},
{
text: "Monster Hunter: Rise",
content: "Jogo de Ação e aventura chega a nova geração de consoles",
},
{
text: "Hogwarts Legacy",
content: "Um dos jogos mais aguardados do ano bate recorde de vendas",
},
];
const wrapper = document.getElementById('main');
posts.forEach(creatArticle);
function creatArticle(post) {
const article = document.createElement('article');
article.classList.add("container");
const title = document.createElement('h2');
const titleText = document.createTextNode(post.text);
title.appendChild(titleText);
const text = document.createElement('p');
const textContent = document.createTextNode(post.content);
text.appendChild(textContent);
wrapper.appendChild(article);
article.appendChild(title);
title.appendChild(text);
}