xxxxxxxxxx
13
const button = document.querySelector('button')
const info = document.querySelector('#info')
const picture = document.querySelector('#picture')
button.addEventListener('click', getPokemon)
async function getPokemon() {
const response = await fetch('https://pokeapi.co/api/v2/pokemon/pikachu')
const data = await response.json()
info.textContent = data.base_experience
picture.src = data.sprites.front_shiny
}