diff --git a/using-fetch/exercise.js b/using-fetch/exercise.js index 34be09e2..81bf34d7 100644 --- a/using-fetch/exercise.js +++ b/using-fetch/exercise.js @@ -17,10 +17,15 @@ Open index.html in your browser. Every time you refresh the page, a different greeting should be displayed in the box. */ -fetch("*** Write the API address here ***") + let greetingElement =document.getElementById("greeting-text"); + +fetch("https://www.greetingsapi.com/random") .then(function (response) { - return response.text(); + return response.json() }) .then(function (greeting) { // Write the code to display the greeting text here + + greetingElement.innerText=`${greeting.greeting} that's greeting in ${greeting.language} `; + });