Requests II
fetch() GET Requests IV

Great job making it this far!

In the previous exercise, you created the query URL, called the fetch() function and passed it the query URL and a settings object. Then, you chained a .then() method and passed it two functions as arguments — one to handle the promise if it resolves, and one to handle network errors if the promise is rejected.

In this exercise, you’ll now take the information that was returned with the promise and manipulate the webpage!



At the end of the .then() method, chain another .then() method.

Pass .then() an anonymous arrow callback function that takes jsonResponse as its single parameter.


Inside the callback function, call the function renderRawResponse() and pass in jsonResponse as an argument. Run the code.

In the input field, you can type in a word and click the submit button.

If all went well, you should see an array of words that the Datamuse API responded with!

You can view the purpose of renderRawResponse at public/helperFunctions.js.


Time to clean up that response a bit. Delete renderRawResponse(jsonResponse) and replace it with renderResponse(jsonResponse).

Run your code.

Try the webpage again with another word!

Folder Icon

Take this course for free

Already have an account?