title: correct way to tell if my selection caught any existing elements
body: <p>I'm making a toggle in d3, and trying to avoid global variables. </p>
  
  <p>I can go ahead and select the item as though it was already in the scene:</p>
  
  <pre><code>d3.select('#awesome_line_graph')
  </code></pre>
  
  <p>and then test to see if I caught anything using </p>
  
  <pre><code>if (d3.select('#awesome_line_graph')[0].every(function(d){return d===null})){
      // draw awesome line graph
  } else {
      d3.select('#awesome_line_graph').remove()
  }
  </code></pre>
  
  <p>but this testing for the zeroth element for maybe more than one null thing seems terrible and hacky. How should I do it instead? Apologies for not knowing much javascript. </p>