вывод моей консоли
У меня проблема с отображением данных в HTML, я получаю объект в консоли без ошибок, но в DOM ничего не отображается. Вы можете увидеть в коде ниже.
fetch("api/meals")
.then(res => {
return res.json();
})
.then(response => {
console.log(response);
let root = `
<h2>meals API</h2>
`;
Array.prototype.forEach.call(response, array => {
const {
id,
title,
description,
location,
when,
max_reservation,
price,
created_date
} = array;
root += `
<h5>meal ID: ${id}</h5>
<ul class="w3-ul">
<li>title : ${title}</li>
<li>description : ${description}</li>
<li>location : ${location}</li>
<li>when : ${when}</li>
<li>max_reservation : ${max_reservation}</li>
<li>price : ${price}</li>
<li>created_date : ${created_date}</li>
</ul>
</div>
`;
document.getElementById("root").innerHTML = root;
});
});