const fetchPokemon = async () => {
	const initial = await fetch('https://pokeapi.co/api/v2/type/1')
	const initialJson = await initial.json()
	//console.log(initialJson.pokemon) // data array

	const detailsData = initialJson.pokemon.map(async i => {
		const preFetchData = await fetch(i.pokemon.url)
		return preFetchData.json()
	})
  
	// uncomment this code if you want to see how it looks await Promise.all(detailsData)
	// const response = await Promise.all(detailsData)
	// console.log(response)
  const payload = (await Promise.all(detailsData)).map(data => ({
		name: data.name,
		image: data.sprites['front_default']
	}))
	console.log('payload', payload) // open inspector code to see the payload in the console
}

fetchPokemon()

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.