title: Unable to appendChild data from a promise in javascript
body: <p>I'm having problems when appending to the body the data returned by a promise. I console log it and everything seem to be working fine, however, when I try to do a simple appendChild to the body, I receive an error which says: "functions.js:73 Uncaught (in promise) TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'"
  I looked this error up on the internet, here in StackOverflow and someone has already asked the same question, but the answer he got doesn't work for me.</p>
  
  <p>Please, can you take a look and help me figure out what's wrong here?</p>
  
  <p>Thanks.</p>
  
  <pre><code>fetchUsers()
    .then(data =&gt; data.json())
    .then(json =&gt; {
      listUsers(json);
      return fetchJanet();
    })
    .then(janetData =&gt; janetData.json())
    .then(janet =&gt; listJanet(janet.data));
  
  function fetchUsers() {
    return fetch("https://reqres.in/api/users");
  }
  
  function listUsers(json) {
    users = json.data;
    users.forEach((element, i) =&gt; {
      n = document.createElement("h3");
      n.innerHTML =
        element.first_name + " " + element.last_name + " have an index of: " + i;
      document.body.appendChild(n);
      document.getElementById("loading").style.display = "none";
    });
  }
  
  function fetchJanet() {
    return fetch("https://reqres.in/api/users/2");
  }
  
  function listJanet(element) {
    console.log(element);
    name = document.createElement("p");
    name.innerHTML = element.first_name + " " + element.last_name;
    document.body.appendChild(name);
  }
  </code></pre>