forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (24 loc) · 782 Bytes
/
Copy pathscript.js
File metadata and controls
24 lines (24 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//TODO: Add Your Code Below
window.addEventListener("load", function() {
const container = document.getElementById('container');
fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function(res){
res.json().then((data){
for(let i = 0; i < data.length; i++ ){
let id = data[i];
container.innerHTML +=`
<div class="astronaut">
<div class="bio">
<h3> ${id.firstName} ${id.lastName} </h3>
<ul>
<li>Hours in space: ${id.hoursInSpace}</li>
<li>Active: ${id.active}</li>
<li>Skills: ${id.skills.join(", ")} </li>
</ul>
</div>
<img class="avatar" src="${id.picture}">
</div>
`;
}
});
});
});