Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
304 B
13
Indexable
Never
  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);
  })