Вопрос по коду JavaScript JSON

Совсем недавно начал учить JavaScript. Имею небольшой вопрос. У меня есть код работающий. Вопрос заключается в том, зачем здесь было необходимо создать пустой массив в шестой строчке? Без массива у меня код не работает Спасибо большое

let div = document.createElement('div');
fetch('https://jsonplaceholder.typicode.com/posts')
 .then(response => response.json())
.then(posts => {
 for (let post of posts){
post.comments = [];
fetch('https://jsonplaceholder.typicode.com/comments')
.then(response => response.json())
.then(comments => {
if (post.id === comment.postId){
post.comments.push(comment);
}
}
let h1 = document.createElement('h1')
let ul = document.createElement('ul')
let li = document.createElement('li')
h1.innerText = `${post.id}`
for (let comment of post.comments){
 li.innerText = `${comment.body}`
}
ul.appendChild(li)
div.appendChild(h1)
div.appendChild(ul)
document.body.appendChild(div)
})
}
});

Ответы (0 шт):