let div = document.getElementById("comments"); let divText = div.innerHTML let length = div.className console.log(divText,length) newPageHTML="" for (let comment = 0; comment < comments[length].length; comment++) { newPageHTML+=`${comments[length][comment][0]}: ${comments[length][comment][1]}` } div.innerHTML = newPageHTML