function showDetail(pokeName) {
    //information is fetched from the pokeapi
    fetch('https://pokeapi.co/api/v2/pokemon/' + pokeName + '/').then(response => {
        response.json().then(pokemon => {
            //relevant data is saved into pre-made html-tags
            let details = '';
            details += document.getElementById('name').innerHTML = "Name: " + pokemon.name;
            details += document.getElementById('picture').innerHTML = `Image: <img src='${pokemon.sprites.front_default}'/>`;
            details += document.getElementById('weight').innerHTML = "Weight: " + pokemon.weight;
            //going through all the abilities of a pokemon in a loop
            let abilities = 'Abilities: <ul>';
            for (const ability of pokemon.abilities) {
                abilities += `<li>${ability.ability.name}</li>`;
            }
            abilities += '</ul>';
            details += document.getElementById('abilities').innerHTML = abilities;
        });
    });
    //make the pre-made html tags, which were invisible by now, visible
    document.getElementById('details').style.display = "block";
}
//function to show the Details for a certain pokemon

function to show the Details for a certain pokemon
function to show the Details for a certain pokemon
function showDetail(pokeName) {
    fetch('https://pokeapi.co/api/v2/pokemon/' + pokeName + '/').then(response => {
        response.json().then(pokemon => {
            let details = '';
            details += document.getElementById('name').innerHTML = "Name: " + pokemon.name;
            details += document.getElementById('picture').innerHTML = `Image: <img src='${pokemon.sprites.front_default}'/>`;
            details += document.getElementById('weight').innerHTML = "Weight: " + pokemon.weight;
            let abilities = 'Abilities: <ul>';
            for (const ability of pokemon.abilities) {
                abilities += `<li>${ability.ability.name}</li>`;
            }
            abilities += '</ul>';
            details += document.getElementById('abilities').innerHTML = abilities;
        });
    });
    document.getElementById('details').style.display = "block";
}
function showDetail ( pokeName ) { fetch ( 'https://pokeapi.co/api/v2/pokemon/' + pokeName + '/' ) . then ( response => { response . json ( ) . then ( pokemon => { let details = '' ; details += document . getElementById ( 'name' ) . innerHTML = "Name: " + pokemon . name ; details += document . getElementById ( 'picture' ) . innerHTML = ` ${ pokemon . sprites . front_default } ` ; details += document . getElementById ( 'weight' ) . innerHTML = "Weight: " + pokemon . weight ; let abilities = 'Abilities: <ul>' ; for ( const ability of pokemon . abilities ) { abilities += ` ${ ability . ability . name } ` ; } abilities += '</ul>' ; details += document . getElementById ( 'abilities' ) . innerHTML = abilities ; } ) ; } ) ; document . getElementById ( 'details' ) . style . display = "block" ; }
function to show the Details for a certain pokemon
function to show the Details for a certain pokemon
//information is fetched from the pokeapi
 //relevant data is saved into pre-made html-tags
 //going through all the abilities of a pokemon in a loop
 //make the pre-made html tags, which were invisible by now, visible
