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(){
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 } ) ;
You can’t perform that action at this time.
0 commit comments