Skip to content

Commit

Permalink
first astronaut added, still needs additional astronauts
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstgr committed Aug 17, 2021
1 parent a93571f commit e690f76
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
// TODO: add code here
window.addEventListener("load", function () {
this.fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function (response) {
fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function (response) {
return response.json();

})
.then()
})
.then(function (astronauts){
let container = document.getElementById("container");
container.innerHTML+= `
<div class="astronaut">
<div class="bio">
<h3>${astronauts[0].firstName} ${astronauts[0].lastName}</h3>
<ul>
<li>Hours in space: ${astronauts[0].hoursInSpace}</li>
<li>Active: ${astronauts[0].active}</li>
<li>Skills: ${astronauts[0].skills}</li>
</ul>
</div>
<img class="avatar" src="${astronauts[0].picture}">
</div>
`

})
})

// <div class="astronaut">
/* <div class="bio">
<h3>Mae Jemison</h3>
<ul>
<li>Hours in space: 190</li>
<li>Active: false</li>
<li>Skills: Physician, Chemical Engineer</li>
</ul>
</div>
<img class="avatar" src="images/mae-jemison.jpg">
</div> */

0 comments on commit e690f76

Please sign in to comment.