FAQ: Requests II - async GET Requests III


This community-built FAQ covers the “async GET Requests III” exercise from the lesson “Requests II”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise async GET Requests III

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


Code isn’t reflecting in webpage

// Information to reach API
const url = 'https://api.datamuse.com/words?’;
const queryParams = ‘rel_jja=’;

// Selecting page elements
const inputField = document.querySelector(’#input’);
const submit = document.querySelector(’#submit’);
const responseField = document.querySelector(’#responseField’);

// AJAX function
const getSuggestions = async () => {
const wordQuery = inputField.value
const endpoint = url + queryParams + wordQuery
try {
const response = await fetch(endpoint)
if(response.ok === ‘true’) {
const jsonResponse = await response.json()
catch(error) {

// Clear previous results and display results to webpage
const displaySuggestions = (event) => {
submit.addEventListener(‘click’, displaySuggestions);

Okay, I followed this exercise I have no syntax errors but this code is not reflecting on the webpage.
Even though in the last two exercises the following statements are made:

  1. “In the response field, type in a word and click the submit button on the web page.
    You should now see an array of objects that contain nouns that describe the word you typed in!”

  2. “Run the code. Then type in another word and click the submit button.
    Great, now you have an organized list of words and you finished your GET request!”

But with this exact code and passing the exercises with no syntax errors the website remains completely unchanged and typing in words does nothing.

There is another file full of helper codes next to the file I’m working in if that makes a difference, but with what I’m working on in this exercise it’s saying that the code I wrote above should affect the webpage and it isn’t.

I would be incredibly grateful if an experienced coder could tell me what I’m missing in this exercise. In a few other exercises the most I’ve ever gotten to show up are the curly brackets {} in the output field.


Your code is really close. This part has the only problem I see:

if(response.ok === 'true') {
  const jsonResponse = await response.json()

In response.ok === 'true', you’re using the identity operator (===) to see if response.ok is a string reading “true”.

The problem is, response.ok is not a string at all; it is a boolean. That makes your if condition automatically false, because === only returns true if the items on both sides share the same type.

So since your if condition is false, renderResponse doesn’t get called and nothing displays on the page.

You can fix it by changing if(response.ok === 'true') to one of these:

if(response.ok === true)