File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,14 @@ window.addEventListener("load", function(){
3
3
console . log ( response ) ;
4
4
response . json ( ) . then ( function ( json ) {
5
5
let container = document . getElementById ( "container" ) ;
6
-
6
+ let astronautCount = 0 ;
7
+
7
8
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">
11
14
<h3>${ json [ index ] . firstName } ${ json [ index ] . lastName } </h3>
12
15
<ul>
13
16
<li>Hours in space: ${ json [ index ] . hoursInSpace } </li>
@@ -17,7 +20,10 @@ window.addEventListener("load", function(){
17
20
</div>
18
21
<img class="avatar" src="${ json [ index ] . picture } ">
19
22
</div>` ;
23
+
20
24
}
25
+ container . innerHTML += `
26
+ <h3>The total number of astronauts is ${ astronautCount } .</h3>`
21
27
22
28
} ) ;
23
29
} ) ;
You can’t perform that action at this time.
0 commit comments