Skip to content

Commit 333a3a1

Browse files
authored
Create script.js
1 parent e3b1ff4 commit 333a3a1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

script.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fetch('data.json')
2+
.then(response => response.json())
3+
.then(data => {
4+
const gamesContainer = document.querySelector('.games');
5+
6+
data.forEach(item => {
7+
const game = document.createElement('div');
8+
game.classList.add('game');
9+
game.innerHTML = `<img src="${item.image}" alt="${item.title}"><h2>${item.title}</h2>`;
10+
gamesContainer.appendChild(game);
11+
});
12+
});

0 commit comments

Comments
 (0)