File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 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+ } )
Original file line number Diff line number Diff line change 11.avatar {
22 border-radius : 50% ;
33 height : 100px ;
4- float : right;
4+ float : right;
55}
66
77.astronaut {
You can’t perform that action at this time.
0 commit comments