Skip to content

Commit d096265

Browse files
committed
1 parent 1636e2c commit d096265

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

script.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ window.addEventListener("load", function(){
33
console.log(response);
44
response.json().then(function(json) {
55
let container = document.getElementById("container");
6-
6+
let astronautCount = 0;
7+
78
for (let index in json) {
8-
container.innerHTML += `
9-
<div class = "astronaut">
10-
<div class = "bio">
9+
astronautCount += 1;
10+
11+
container.innerHTML += `
12+
<div class = "astronaut">
13+
<div class = "bio">
1114
<h3>${json[index].firstName} ${json[index].lastName}</h3>
1215
<ul>
1316
<li>Hours in space: ${json[index].hoursInSpace}</li>
@@ -17,7 +20,10 @@ window.addEventListener("load", function(){
1720
</div>
1821
<img class="avatar" src="${json[index].picture}">
1922
</div>`;
23+
2024
}
25+
container.innerHTML += `
26+
<h3>The total number of astronauts is ${astronautCount}.</h3>`
2127

2228
});
2329
});

0 commit comments

Comments
 (0)