From 435f9a7b2b44524d666af6c27d2616b885a39201 Mon Sep 17 00:00:00 2001 From: AnnaK Date: Tue, 14 Jun 2022 11:29:01 -0400 Subject: [PATCH] Added code in script.js --- script.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 9417030..c111ea5 100644 --- a/script.js +++ b/script.js @@ -1 +1,24 @@ -// 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) { + response.json() .then(function(json) { + for (let i = 0; i < json.length; i++) { + const container = document.getElementById("container"); + container.innerHTML += + ` +
+
+

${json[i].firstName} ${json[i].lastName}

+
    +
  • Hours in space: ${json[i].hoursInSpace}
  • +
  • Active: ${json[i].active}
  • +
  • Skills: ${json[i].skills}
  • +
+
+ +
+ `; + } + }); + }); +}); \ No newline at end of file