Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
365 B
3
Indexable
Never

async function getPokeApi(){
    json = await fetch("https://pokeapi.co/api/v2/pokemon/voltorb")
    .then((response) => response.json()
    .catch(error => console.log(error)))
    return json 
}

getPokeApi().then(json => {alert(`: Min sjefs favorittpokemon er ${json["name"]}. Den er ${json["height"]} høy, veier ${json["weight"]} og har ID ${json["id"]}`)})