fetch('https://jsonplaceholder.typicode.com/albums')
.then(r => r.json())
.then(r => {
document.body.insertAdjacentHTML('beforeend', `
<div class="wrapper">${r.map(n => `
<div class="item">
<div>UserId: ${n.userId}</div>
<div>Id: ${n.id}</div>
<div>Title: ${n.title}</div>
</div>`).join('')}
</div>
`);
});
.item {
border: 1px solid silver;
padding: 10px;
margin: 10px;
}
fetch('https://jsonplaceholder.typicode.com/albums')
.then(response => response.json())
.then(data => data.forEach((album) => {
document.body.insertAdjacentHTML('beforeEnd', `
<p>${album.userId}</p>
<p>${album.id}</p>
<p>${album.title}</p>
`)
}))