Skip to content

Commit e690f76

Browse files
committed
first astronaut added, still needs additional astronauts
1 parent a93571f commit e690f76

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

script.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11
// TODO: add code here
22
window.addEventListener("load", function () {
3-
this.fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function (response) {
3+
fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function (response) {
44
return response.json();
55

66
})
7-
.then()
8-
})
7+
.then(function (astronauts){
8+
let container = document.getElementById("container");
9+
container.innerHTML+= `
10+
<div class="astronaut">
11+
<div class="bio">
12+
<h3>${astronauts[0].firstName} ${astronauts[0].lastName}</h3>
13+
<ul>
14+
<li>Hours in space: ${astronauts[0].hoursInSpace}</li>
15+
<li>Active: ${astronauts[0].active}</li>
16+
<li>Skills: ${astronauts[0].skills}</li>
17+
</ul>
18+
</div>
19+
<img class="avatar" src="${astronauts[0].picture}">
20+
</div>
21+
`
22+
23+
})
24+
})
25+
26+
// <div class="astronaut">
27+
/* <div class="bio">
28+
<h3>Mae Jemison</h3>
29+
<ul>
30+
<li>Hours in space: 190</li>
31+
<li>Active: false</li>
32+
<li>Skills: Physician, Chemical Engineer</li>
33+
</ul>
34+
</div>
35+
<img class="avatar" src="images/mae-jemison.jpg">
36+
</div> */

0 commit comments

Comments
 (0)