Skip to content

Commit b1eb6bc

Browse files
committed
Completed basic studio tasks
1 parent 7d54ab1 commit b1eb6bc

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

script.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
// TODO: add code here
1+
window.addEventListener("load", event => {
2+
fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(response => {
3+
response.json().then(json => {
4+
console.log(json);
5+
const con = document.getElementById("container");
6+
7+
for (let i = 0; i < json.length; i++) {
8+
con.innerHTML += `
9+
<div class="astronaut">
10+
<div class="bio">
11+
<h3>${json[i].firstName} ${json[i].lastName}</h3>
12+
<ul>
13+
<li>Hours in space: ${json[i].hoursInSpace}</li>
14+
<li>Active: ${json[i].active}</li>
15+
<li>Skills: ${json[i].skills.join(", ")}</li>
16+
</ul>
17+
</div>
18+
<img class="avatar" src="${json[i].picture}">
19+
</div>`
20+
21+
}
22+
23+
})
24+
})
25+
})

style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.avatar {
22
border-radius: 50%;
33
height: 100px;
4-
float:right;
4+
float: right;
55
}
66

77
.astronaut {

0 commit comments

Comments
 (0)