Skip to content

Commit 2de8f59

Browse files
committed
Complete 26.6.3 Bonus Missions LaunchCodeEducation#3 - Add astronaut count
1 parent 1ad6853 commit 2de8f59

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

script.js

+8-3
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)