title: Merge two arrays of dictionaries in javascript
body: <p>I have two arrays of dictionaries which look something like this:</p>
  
  <pre><code>var lat = [{key:"2017-09-20T11:51:32.000Z", value:50.7825333},{key:"2017-09-20T11:51:33.000Z", value:50.7826},...];
  var lon = [{key:"2017-09-20T11:51:32.000Z", value:-1.3075833},{key:"2017-09-20T11:51:33.000Z", value:-1.3076},...];
  </code></pre>
  
  <p>You might have guessed that one is an array of latitudes and one of longitudes!</p>
  
  <p>I would like an elegant way of merging time, lat, lon into one array. Both arrays contain the same keys (I should check that this is always the case!).</p>
  
  <pre><code>var latLon = [{time:"2017-09-20T11:51:32.000Z", lat:50.7825333, lon:-1.3075833},...]
  </code></pre>
  
  <p>I have thrown something together that works but isn't pretty (ie iterate both arrays and append to a new one) but it feels like there must be a more stylish way using Object.assign with some nice lamdas. I am also using the D3.js library if that contains any useful methods.</p>