File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
window . addEventListener ( "load" , function ( ) {
2
- let json = [ ] ;
2
+ // let json = [];
3
3
fetch ( "https://handlers.education.launchcode.org/static/astronauts.json" ) . then ( function ( response ) {
4
4
console . log ( response ) ;
5
5
response . json ( ) . then ( function ( json ) {
6
6
const container = document . getElementById ( "container" ) ;
7
7
let index = 0 ;
8
- container . addEventListener ( "click" , function ( ) {
8
+
9
+ // container.addEventListener("click", function(){
9
10
container . innerHTML = `
10
11
<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>
13
14
<ul>
14
15
<li>Hours in space: ${ json [ index ] . hoursInSpace } </li>
15
16
<li>Active: ${ json [ index ] . active } </li>
16
17
<li>Skills: ${ json [ index ] . skills } </li>
17
18
</div>
18
- <img class="avatar" src="images/mae-jemison.jpg ">
19
+ <img class="avatar" src="${ json [ index ] . picture } ">
19
20
</div>
20
-
21
- ` ;
21
+ ` ;
22
22
index = ( index + 1 ) % json . length ;
23
- < / div >
24
- } ) ;
23
+ // });
25
24
26
25
} ) ;
27
26
} ) ;
You can’t perform that action at this time.
0 commit comments