title: How do your write a function that returns values from an array?
body: <p>I created this array: </p>
  
  <pre><code>var lineData = [ { "x": 25,   "y": 75},  { "x": 85,   "y": 130},
               { "x": 140,  "y": 190}, { "x": 195,  "y": 245},
               { "x": 195,  "y": 300}, { "x": 25,  "y": 350},
               { "x": 80,  "y": 405}, { "x": 195,  "y": 460}];
  </code></pre>
  
  <p>Now I want to draw ellipses on the coordinates in the array. How do I create a function that will access the x and y values? How do functions work?</p>
  
  <pre><code>// Draw ellipses 
  var circle = svgContainer.append("ellipse")
      .attr("cx", function(d) { return d.x; }})
      .attr("cy", function(d) { return d.y; })
      .attr("rx", 5)
      .attr("ry", 5);
  </code></pre>