-3

When I run the following code:

const root = document.querySelector('#root3');

async function fetchData(userId) {
  const response = await fetch(`https://randomuser.me/api/?results=10`);
  const data = await response.json();
  console.log(data);
  console.log(data.results);
  data.results.map(item => {
    root.append(`<li><img src=${item.picture.thumbnail}></li>`);
  });
}

fetchData();

The result is this:

enter image description here

Why are those quotations there? and how can I get rid of them?

Icy Creature
  • 1,875
  • 2
  • 28
  • 53
user1941537
  • 6,097
  • 14
  • 52
  • 99

1 Answers1

0

OK. You cannot use append in JavaScript. One solution, which is working is the following:

root.innerHTML += `<li><img src=${item.picture.thumbnail}></li>`;
user1941537
  • 6,097
  • 14
  • 52
  • 99