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 () 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 () below!
Agree with a comment or answer? Like () to up-vote the contribution!
I having trouble with the fetch()GET III lesson. in step 7;
.
Inside the success callback function, create a conditional statement that checks if the ok property of the response object evaluates to a truthy value. If so, call the function renderJsonResponse() and pass in response as an argument. Then, run your code.
Then type in a word to and click the submit button to view the JSON that came back. The status of the promise return from fetch() will be resolved.
You are missing the opening curly brace following your if(response.ok) condition. Also the instructions ask you to call the renderJsonResponse() function with response as the argument, but do not ask you to return it. Delete return, add the curly brace, and it should work. Good luck && Happy Coding!
ok it worked but i have no idea what the ■■■■ is going on. this whole chapter baffles me. The solutions they give in the hints are quite different than the solutions they give if you click on the get solution button. I’m totally confused. What can I do? i really want to finish this course but i think my subscription runs out in june. do i really have to know all this crap to make money building websites for people?
sorry chadrew i’m a novice but the code i given to you worked well for me. Maybe it is just a simple syntax error. sorry if i disturbed you. i just wanted to help you because i really passed this step with this code. Good luck for the future.
in the absence of else, the statement following ‘if’ will always be executed hence whether you use else or not does not matter, it will be executed.
in this example if the ‘if’ condition is true ( I mean response.ok === TRUE) it will execute ’ return response.json()’, and once this line is executed, execution will stop on this line itself, that’s the beauty of return statement.
Statement “throw new Error(‘Request failed!’)” will be executed if the ‘if (response.ok)’ is false.
Hi @Midlindner ,
The content doesn’t clearly mention that response.body (where all the data returned from the API lie)is not directly accessible from response object. Instead, we use the method response.json() to access these data. For a beginner like me, it took a lot of time to figure this out. How can this feedback be passed to the content team?
I did everything to codecademy’s satisfaction and earned my blue-green check boxes, but the page is completely unresponsive. the datamuse website is not down. I popped open the DOM console, and found this solicitation from codecademy: “ Hi there!
While you’re here, how about popping over to https://codecademy.com/about/careers?
We’re hiring for passionate, talented engineers, and would love to hear from you! ” - but no obvious errors. I wish I knew why it isn’t working! Here’s my code: // Information to reach API
const url = ‘https://api.datamuse.com/words’;
const queryParams = ‘?sl=’;
It seems pointless that exercise #4 and 5 are split. I spent a lot of time after completing #4 trying to figure out why it wasn’t working. I think spent more time trying to debug code that had no bugs, than I did on exercise #5.
I couldn’t get the code in this example to run properly. I get ‘green ticks’ down the left margin but when I run the example code, it just returns a ‘blank’ response. This is the code I’m using …