title: Merge objects based on same key from different positions in an array
body: <p>I have 2 arrays of 20 objects that I want to merge by name. The order of the names in each array is different, and the order is important and has to be left as is. This prevents me from a traditional sort and <code>for</code> loop approach. Basically, what I have is:</p>
  
  <pre><code>var tempList1 = [
     {'manager':'John', 'x1':0, 'y1':0, 'x2':1, 'y2':1},
     {'manager':'Tom', 'x1':0, 'y1':50, 'x2':1, 'y2':1},
     {'manager':'Julie', 'x1':0, 'y1':80, 'x2':1, 'y2':1},
  ...
  ];
  
  var tempList2 = [
     {'manager':'Tom', 'x3':0, 'y3':10, 'x4':1, 'y4':1},
     {'manager':'Julie', 'x3':0, 'y3':90, 'x4':1, 'y4':1},
     {'manager':'John', 'x3':0, 'y3':50, 'x4':1, 'y4':1},
  ...
  ];
  </code></pre>
  
  <p>Notice that <code>John</code> is at index <code>0</code> in <code>tempList1</code> but is at index <code>2</code> at <code>tempList2</code>. When I tried:</p>
  
  <pre><code>          for (var k = 0; k &lt; managerList.length; k++) {
              let merged = {...tempList1[k],...tempList2[k]}
              combinedList.push(merged);
            }
  </code></pre>
  
  <p>I was making the mistake of assuming the order was the same in each array -- when its not.</p>
  
  <p>End result should be:</p>
  
  <pre><code>var combinedList = [
      {'manager':'John', 'x1':0, 'y1':0, 'x2':1, 'y2':1, 'x3':0, 'y3':50, 'x4':1, 'y4':1},
      {'manager':'Tom', 'x1':0, 'y1':50, 'x2':1, 'y2':1, 'x3':0, 'y3':10, 'x4':1, 'y4':1},
      {'manager':'Julie', 'x1':0, 'y1':80, 'x2':1, 'y2':1, 'x3':0, 'y3':90, 'x4':1, 'y4':1}
  ];
  </code></pre>
  
  <h2>Question</h2>
  
  <p>How can I merge objects so that only objects when the same <code>manager</code> value are merged with each other in my array?</p>