title: How to get the data from an array of urls with axios and promises
body: <p>I have this endpoint that gives me the info about a specific character, looks like this:</p>
  
  <p>Endpoint: 
  <code>https://rickandmortyapi.com/api/character/1</code></p>
  
  <p>that gives me back an object with the name of the chracter as well as other properies, one of those properties is called episode.</p>
  
  <pre><code>{
    name: 'Ricky',
    id: 1,
    episode: [...]
  }
  </code></pre>
  
  <p>And the episode property contains an aray of urls that look like this:</p>
  
  <pre><code>[
    "https://rickandmortyapi.com/api/episode/1",
    "https://rickandmortyapi.com/api/episode/2",
    "https://rickandmortyapi.com/api/episode/3"
    ...
  ]
  </code></pre>
  
  <p>I know I should use Promise.all and somehow loop over these and then resolve them but I cant get it to work.</p>
  
  <p>This is what I tried, but I dont know if its correct, and it always gives back a promise no matter how many times I do <code>.then</code></p>
  
  <pre><code>let episodeResponses;
  
    const episodesResponses = Promise.all(character.episode.map(url =&gt; {
      return axios(url)
        .then(resp =&gt; episodeResponses = resp)
    }))
  
    episodesResponses.then(x =&gt; console.log(x))
  </code></pre>
  
  <p>Any ideas on how to get this working?</p>
  
  <p>Thanks</p>