Код: Выделить всё
Document
Place Holder
// API for get requests
let fetchRes = fetch('https://www.reddit.com/r/meme/top.json');
fetchRes.then(res =>
res.json()).then(d => {
console.log(d)
// for testing purposes, use the following:
// console.log(d.data.children[0].data.id);
for (let i = 0; i < d.data.children.length; i++) {
x = d.data.children[i].data.url
document.getElementById("name").append("
")
console.log(d.data.children[i].data.url);
}
})
Код: Выделить всё
.document.getElementById("name").innerHTML = x
Подробнее здесь: https://stackoverflow.com/questions/793 ... element-id
Мобильная версия