Why I can't get ${articlesData.results.map().join('')}
work on second part of code. But const names = res.results.map(article => article.title).join('\n');
is working in first part?
How can I get it work in second part of code as well?
const articlesData = fetch('https://reqres.in/api/users?page=2')
.then(res => res.json())
.then(res => {
res.data.map(article => {
console.log(`${article.degree} ${article.title}`);
const names = res.data.map(article => article.title).join('\n');
});
});
document.getElementById('js-card').innerHTML = `
<p> ${articlesData.data.map().join('')} </p>
`
I found other somewhat similar questions but answers didn't work.