Untitled

 avatar
unknown
javascript
3 years ago
304 B
16
Indexable
  for (let i = 1; i <= 4; i++) {
    const url = `https://pokeapi.co/api/v2/pokemon/${i}`;
    myPokemons3.push(fetch(url).then(res => res.json()));
  }

  Promise.all(myPokemons3).then(results => {
    const pokemon = results.map(data => ({
      name: data.name,
    }));
    console.log(pokemon);
  })
Editor is loading...