title: d3 bar chart selectAll before appending
body: <p>I've been learning more about the d3 visualization library, and I've seen a few examples of bar charts that have a snippet that looks like</p>
  
  <pre><code>chart.selectAll("rect")
  .data(data)
  .enter().append("rect")
  .attr("y", y)
  .attr("width", x)
  .attr("height", y.rangeBand());
  </code></pre>
  
  <p>My confusion is with the first <code>selectAll</code> line. What is the purpose of selecting all rects before they exist since we'll be appending new rects on data enter? Does what goes in the selectAll matter if none of those elements exist?</p>