0
The console indicates a wrong saying Uncaught Typeerror: Cannot read Property 'name' of Undefined. within the scope of the function in which API access can access name and other keys.
the code:
function swapiGet(params){
const url = `https://swapi.dev/api/${params}`;
fetch(url)
.then(response => response.json())
.then(json => json)
}
function preencherAssets(){
personagens.innerHTML = swapiGet("people/1/").name;
console.log('primeiro')
}
preencherAssets();
Does anyone know why and how to fix it? I started to study Names and consume Apis recently.