Skip to content

Commit 72c11eb

Browse files
committed
single astronaut
1 parent 7765c01 commit 72c11eb

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

script.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
window.addEventListener("load", function(){
2-
let json = [];
2+
// let json = [];
33
fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function(response) {
44
console.log(response);
55
response.json().then(function(json) {
66
const container = document.getElementById("container");
77
let index = 0;
8-
container.addEventListener("click", function(){
8+
9+
// container.addEventListener("click", function(){
910
container.innerHTML = `
1011
<div class = "astronaut">
11-
<div class = "bio">
12-
<h3>${json[index].firstName, json[index].lastName}</h3>
12+
<div class = "bio">
13+
<h3>${json[index].firstName} ${json[index].lastName}</h3>
1314
<ul>
1415
<li>Hours in space: ${json[index].hoursInSpace}</li>
1516
<li>Active: ${json[index].active}</li>
1617
<li>Skills: ${json[index].skills}</li>
1718
</div>
18-
<img class="avatar" src="images/mae-jemison.jpg">
19+
<img class="avatar" src="${json[index].picture}">
1920
</div>
20-
21-
`;
21+
`;
2222
index = (index + 1) % json.length;
23-
</div>
24-
});
23+
// });
2524

2625
});
2726
});

0 commit comments

Comments
 (0)