Skip to content

Commit 1636e2c

Browse files
committed
all but bonus
1 parent 72c11eb commit 1636e2c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

script.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
window.addEventListener("load", function(){
2-
// let json = [];
32
fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function(response) {
43
console.log(response);
54
response.json().then(function(json) {
6-
const container = document.getElementById("container");
7-
let index = 0;
5+
let container = document.getElementById("container");
86

9-
// container.addEventListener("click", function(){
10-
container.innerHTML = `
7+
for (let index in json) {
8+
container.innerHTML += `
119
<div class = "astronaut">
1210
<div class = "bio">
1311
<h3>${json[index].firstName} ${json[index].lastName}</h3>
1412
<ul>
1513
<li>Hours in space: ${json[index].hoursInSpace}</li>
1614
<li>Active: ${json[index].active}</li>
1715
<li>Skills: ${json[index].skills}</li>
16+
</ul>
1817
</div>
1918
<img class="avatar" src="${json[index].picture}">
20-
</div>
21-
`;
22-
index = (index + 1) % json.length;
23-
// });
19+
</div>`;
20+
}
2421

2522
});
2623
});

0 commit comments

Comments
 (0)