XHR GET Requests IV and XHR Post Requests III

I have a question.
in XHR GET Requests IV step 5 theres .word method that I cant find, were is it?

 // Creates an empty array to contain the HTML strings
  let wordList = [];
  // Loops through the response and caps off at 10
  for(let i = 0; i < Math.min(res.length, 10); i++){
    // creating a list of words

Theres one similar in step 9 ( XHR Post Requests III): .shortUrl ?

const renderResponse = (res) => {
  // Displays either message depending on results
    responseField.innerHTML = "<p>Sorry, couldn't format your URL.</p><p>Try again.</p>";
  } else {  
    responseField.innerHTML = `<p>Your shortened url is: </p><p> ${res.shortUrl} </p>`;

thankfull for answers


there isn’t a word method, the response is very likely json has key/value pairs. You could log the entire response to insect it? For the GET exercise, you seem to have an array with objects. These objects have a word key.

in the post, you seem to get back a single object with shortUrl key (which has a value).


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.