title: JS: mapping an array inside a push
body: <p>Is there a better way to get the <code>bio</code> object into the pushed chart <code>values</code>?</p>
  
  <pre><code>// date and value keys.
  var data = {"1":[{"date":"2014-03-10","value":14},{"date":"2014-03-17","value":15},{"date":"2014-03-19","value":13},{"date":"2014-04-11","value":11},{"date":"2014-04-13","value":13.7},{"date":"2014-04-14","value":14.6},{"date":"2014-04-15","value":17},{"date":"2014-04-17","value":9},{"date":"2014-04-20","value":10},{"date":"2014-04-21","value":17},{"date":"2014-04-24","value":15},{"date":"2014-05-02","value":10},{"date":"2014-05-03","value":95.3},{"date":"2014-05-09","value":92.1},{"date":"2014-05-12","value":3},{"date":"2014-05-14","value":88.9},{"date":"2014-05-15","value":95.3},{"date":"2014-05-23","value":82.6},{"date":"2014-05-24","value":95.3},{"date":"2014-05-30","value":99},{"date":"2014-05-31","value":88.9},{"date":"2014-06-01","value":80},{"date":"2014-06-17","value":82},{"date":"2014-07-08","value":95},{"date":"2014-07-30","value":127},{"date":"2014-08-02","value":90},{"date":"2014-08-03","value":80},{"date":"2014-08-09","value":82}],"2":[{"date":"2014-03-10","value":"1"},{"date":"2014-03-19","value":"23"},{"date":"2014-04-11","value":"14"},{"date":"2014-04-13","value":"14.4"},{"date":"2014-04-14","value":"14"},{"date":"2014-04-21","value":"11"},{"date":"2014-04-24","value":"13.5"},{"date":"2014-05-04","value":"4"},{"date":"2014-05-15","value":"15"},{"date":"2014-05-17","value":"16"},{"date":"2014-05-23","value":"9.3"},{"date":"2014-05-24","value":"11"},{"date":"2014-05-25","value":"14.9"},{"date":"2014-06-01","value":"14.1"}]};
  
  var bio = [];
  $.each(data['1'], function(date, value) {
      bio.push({x: value['date'], y: Math.round(value['value'])});
  });
  
  chart = [];
  chart.push({
      area: true,
      color: '#FFBA78',
      values: bio,
  });
  </code></pre>
  
  <p>Basically what I'm doing is taking the data['1'] array, and for each node I'm changing the keys: <code>date</code> into <code>x</code>, and <code>value</code> into <code>y</code>. I think this may be possible with an array map? Something like:</p>
  
  <pre><code>chart.push({
      area: true,
      color: '#FFBA78',
      values: data['1'].map(function() { ... }),
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/x24and0w/" rel="nofollow">Here's a JSFiddle.</a></p>