Untitled
unknown
javascript
4 years ago
304 B
17
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...