title: d3.js: Help understanding parameters to callback functions
body: <p>I'm trying to learn d3.js and I find <a href="https://bl.ocks.org/mbostock" rel="nofollow noreferrer">Mike Bostock's bl.ocks</a> very helpful, but often I get hung up on small details in his code. For instance, in his <a href="https://bl.ocks.org/mbostock/3886208" rel="nofollow noreferrer">Stacked Bar Chart bl.ock</a>, he parses a CSV using <code>d3.csv</code>:</p>
  
  <pre><code>d3.csv("data.csv", function(d, i, columns) {
    for (i = 1, t = 0; i &lt; columns.length; ++i) t += d[columns[i]] = +d[columns[i]];
    d.total = t;
    return d;
  }...
  </code></pre>
  
  <p>I noticed that the anonymous callback function has a third parameter - I'm used to seeing <code>function(d, i) {...}</code>, but not <code>function(d, i, columns) {...}</code>. I've spent a decent amount of time looking through the <a href="https://github.com/d3/d3/blob/master/API.md" rel="nofollow noreferrer">API documentation</a> and googling, but I can't find ground truth on what parameters can be passed to the callback function by <code>d3.csv()</code> (or any of the other parsers, for that matter). </p>
  
  <p>Could someone either: </p>
  
  <ul>
  <li>Direct me to where this is documented, or</li>
  <li>Explain the more fundamental d3 or JavaScript concept I may be missing here?</li>
  </ul>
  
  <p>To be clear, I understand what is being passed in via the <code>columns</code> parameter, I'm just trying to understand where I could go to know that the third parameter is the array of column names and what other parameters can be passed.</p>