title: Checking if an element created by javascript exists using only javascript
body: <p>The question is quite straightforward. Is there a javascript only (no jQuery/other library pls) method of checking if an element created via javascript exists?</p>
  
  <p>For instance, if I did this: </p>
  
  <pre><code>var foo=document.createElement("div");
  document.getElementById("bar").appendChild(foo);
  </code></pre>
  
  <p>Would there be a way to check if foo already exists? </p>