Skip to content

Commit

Permalink
Complete 26.6.3 Bonus Missions LaunchCodeEducation#3 - Add astronaut …
Browse files Browse the repository at this point in the history
…count
  • Loading branch information
maymlin committed Jul 27, 2021
1 parent 1ad6853 commit 2de8f59
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ window.addEventListener("load", function() {
response.json()
.then(function(jsonString) {
// console.log(jsonString);

// 26.6.3 Bonus Missions
let contentSpace = document.getElementById("container");
// 26.6.3 Bonus Missions #1 and 2
let hoursArray = [];
jsonString.forEach(function(astronaut) {
hoursArray.push(astronaut.hoursInSpace);
Expand All @@ -32,7 +32,12 @@ window.addEventListener("load", function() {
}
*/

document.getElementById("container").innerHTML = astronautInfo;
// 26.6.3 Bonus Missions #3
let newElement = document.createElement("h2");
newElement.innerHTML = `Astronaunt count: ${jsonString.length}`;
document.querySelector("body").insertBefore(newElement, contentSpace);

contentSpace.innerHTML = astronautInfo;
});
});
});
Expand Down

0 comments on commit 2de8f59

Please sign in to comment.