File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ window.addEventListener("load", function() {
55 response . json ( )
66 . then ( function ( jsonString ) {
77 // console.log(jsonString);
8-
9- // 26.6.3 Bonus Missions
8+ let contentSpace = document . getElementById ( "container" ) ;
9+ // 26.6.3 Bonus Missions #1 and 2
1010 let hoursArray = [ ] ;
1111 jsonString . forEach ( function ( astronaut ) {
1212 hoursArray . push ( astronaut . hoursInSpace ) ;
@@ -32,7 +32,12 @@ window.addEventListener("load", function() {
3232 }
3333 */
3434
35- document . getElementById ( "container" ) . innerHTML = astronautInfo ;
35+ // 26.6.3 Bonus Missions #3
36+ let newElement = document . createElement ( "h2" ) ;
37+ newElement . innerHTML = `Astronaunt count: ${ jsonString . length } ` ;
38+ document . querySelector ( "body" ) . insertBefore ( newElement , contentSpace ) ;
39+
40+ contentSpace . innerHTML = astronautInfo ;
3641 } ) ;
3742 } ) ;
3843} ) ;
You can’t perform that action at this time.
0 commit comments