File tree 1 file changed +26
-0
lines changed 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1
1
//TODO: Add Your Code Below
2
+ window . addEventListener ( "load" , function ( ) {
3
+ // TODO: fetch planets JSON
4
+ fetch ( "https://handlers.education.launchcode.org/static/astronauts.json" ) . then ( function ( response ) {
5
+ response . json ( ) . then ( function ( json ) {
6
+ const container = document . getElementById ( "container" ) ;
7
+ let astronauts = '' ;
8
+ for ( let i = 0 ; i < json . length ; i ++ ) {
9
+ astronauts += `
10
+
11
+ <div class="astronaut">
12
+ <div class="bio">
13
+ <h3>${ json [ i ] . firstName } ${ json [ i ] . lastName } </h3>
14
+ <ul>
15
+ <li>Hours in space: ${ json [ i ] . hoursInSpace } </li>
16
+ <li style="color:green">Active: ${ json [ i ] . active } </li>
17
+ <li>Skills: ${ json [ i ] . skills } </li>
18
+ </ul>
19
+ </div>
20
+ <img class="avatar" src="${ json [ i ] . picture } ">
21
+ </div>`
22
+ }
23
+ container . innerHTML = astronauts ;
24
+ } ) ;
25
+ } ) ;
26
+ } ) ;
27
+
You can’t perform that action at this time.
0 commit comments