title: Console blocking execution because getElementbyId is null (but I want it to be)
body: <p>EDIT: The answers of Mr. Veron, Mr. Spungin, and Mr. Shah fit my needs perfectly. My error is apparent, and the console's warning perfectly sensible. Thank you all.</p>
  <p>I'm trying to determine the existence of an element in the DOM. <a href="https://stackoverflow.com/questions/10886190/check-if-a-div-does-not-exist-with-javascript">In accordance with what  extant posts have suggested</a>, I've resorted to using getElementbyId + querySelector and then checking if it's null/undefined with a conditional.</p>
  <pre><code>let target = document.getElementbyId(a).querySelector(b)
  
  if(typeof(target) != 'undefined' &amp;&amp; target != null){
  ...
  }
  </code></pre>
  <p>Here's where I run into an error. When the first line executes, my console tosses up the error</p>
  <pre><code>Uncaught (in promise) TypeError: document.getElementById(...) is null
  </code></pre>
  <p>because &quot;target&quot; is null -- but I <em>intend</em> for it to be null, and thus am mildly irked that the console is for once acting against my interest.</p>
  <p>This is an <a href="https://stackoverflow.com/questions/5629684/how-can-i-check-if-an-element-exists-in-the-visible-dom">implementation offered and endorsed by many on Stack Overflow</a> -- and yet I cannot easily find people facing the same obstruction that I am. Therefore, I'd appreciate any explanations for why such a warning is needed or ways to circumvent it (a better implementation than what has been widely suggested ). Much thanks.</p>