const pokedex$$ = document.querySelector("#pokedex");
const pokeUrl = "https://pokeapi.co/api/v2/pokemon/";
const myPokemons = [];
const myPokemons2 = [];
const getPokemon = async (index) => {
//console.log(`${pokeUrl}${index}`);
const res = await fetch(`${pokeUrl}${index}`);
const resJson = await res.json();
console.log(resJson);
return resJson;
};
const getPokemon2 = (index) => {
fetch(`${pokeUrl}${index}`)
.then((res) => res.json())
.then((myJson) => {
console.log(myJson);
return myJson;
});
};
for (let i = 1; i < 4; i++) {
myPokemons.push(getPokemon(i));
myPokemons2.push(getPokemon2(i));
}
console.log(myPokemons);
console.log(myPokemons2);