Where is the error in my code?
I am not able to list all the names in a <li>
different, in my console.log(items[i].name)
all the names of the JSON appear, however at the time of creating the html element it only takes the last name.
const myList = fetch('people.json')
.then(response => response.json())
.then(result => {
const items = result.data;
for(let i = 0; i < items.length; i++) {
let people = document.getElementById("people");
console.log(items[i].name)
const markup = '
<li>
${items[i].name}
</li>
';
people.innerHTML = markup;
}
})
.catch(err => {
console.log("Erro");
});