title: How to check if an element has a specific child?
body: <p>How to check if an element has a specific child?</p>
  
  <p>I added children to my element using:</p>
  
  <pre><code>var child1 = document.createElement('div');
  document.body.appendChild(child1);
  </code></pre>
  
  <p>How can I check whether <code>child1</code> is already attached to <code>body</code>?</p>
  
  <pre><code>if (document.body.alreadyHas(child1)) …
                    ^^^^^^^^^^
                  what to do here?
  </code></pre>