title: csv to array in d3.js
body: <p>I am using this to parse a csv file and create an array data as specified in d3 docs:</p>
  
  <pre><code>d3.csv("afile.csv", function(data) {
      data.forEach(function(d) {
      d.date = formatDate.parse(d.date);
      d.price = +d.price;
  });
  </code></pre>
  
  <p>However, if after this method I try to call <code>data[0]</code> it says it is undefined. Is this because <code>data</code> is a reference and once <code>d3.csv()</code> is out of scope is destroyed? If this is the case how can I overcome this. I need to reference data out of <code>d3.csv()</code></p>