File tree 1 file changed +8
-3
lines changed
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() {
5
5
response . json ( )
6
6
. then ( function ( jsonString ) {
7
7
// 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
10
10
let hoursArray = [ ] ;
11
11
jsonString . forEach ( function ( astronaut ) {
12
12
hoursArray . push ( astronaut . hoursInSpace ) ;
@@ -32,7 +32,12 @@ window.addEventListener("load", function() {
32
32
}
33
33
*/
34
34
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 ;
36
41
} ) ;
37
42
} ) ;
38
43
} ) ;
You can’t perform that action at this time.
0 commit comments