Untitled

 avatar
unknown
javascript
3 years ago
365 B
3
Indexable

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"]}`)})