title: d3.each() index doesn't begin at 0
body: <p>My question is very similar to <a href="https://stackoverflow.com/questions/29337471/d3-selection-html-index-starting-at-1-instead-of-0-when-passing-function">this</a>. The solution there was that there was a <code>&lt;div&gt;</code> messing things up. There are no <code>&lt;divs&gt;</code> in mine.</p>
  
  <p>I have this CoffeeScript code:</p>
  
  <pre><code>data = [0, 1, 2, 3, 4]
  d3.select("body")
    .data(data)
    .enter()
    .each((d, i) =&gt;
      console.log(i, d)
    )
  </code></pre>
  
  <p>With the <strong>desired</strong> console output being:</p>
  
  <pre><code>0 0
  1 1
  2 2
  3 3
  4 4
  </code></pre>
  
  <p>The <strong>actual</strong> console output is:</p>
  
  <pre><code>1 1
  2 2
  3 3
  4 4
  </code></pre>
  
  <p>I can get the desired output with this code:</p>
  
  <pre><code>data = [0, 1, 2, 3, 4]
  d3.select("body")
    .data(data)
    .each((d, i) =&gt;
      console.log(i, d)
    ).enter()
     .each((d, i) =&gt;
      console.log(i, d)
    )
  </code></pre>
  
  <p>But it just feels wrong to have two .each() calls.</p>