diff --git a/index.html b/index.html index c69204f..8050809 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,17 @@ - - - - Astronauts - - - - -

Astronauts

-
- -
- - \ No newline at end of file + + + + Astronauts + + + + +

Astronauts

+

+
+ +
+ + diff --git a/script.js b/script.js index 9417030..65f5593 100644 --- a/script.js +++ b/script.js @@ -1 +1,32 @@ -// TODO: add code here \ No newline at end of file +// TODO: add code here +window.addEventListener("load",function(){ + fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function(response){ + console.log(response) + response.json().then(function(json){ + console.log(json); + let astronauts = ""; + let counter = 0; + let container = document.getElementById("container"); + for(astronaut of json){ + console.log(astronaut); + astronauts +=`
+
+

${astronaut.firstName} ${astronaut.lastName}

+ +
+ +
` + counter++ + } + let count = document.getElementById("count"); + count.innerHTML = `

Count: ${counter}

` + container.innerHTML = astronauts; + }) + + }) +})