title: Loop over a reference object multiple times to copy its properties to other objects in Javascript/Angularjs
body: <p>Let's say I have an array of objects called arr1:</p>
  
  <pre><code>[{a:1, b:2, c:3, type:1}, {c:1, type:2}, {d:1, e:2, type:2}]
  </code></pre>
  
  <p>The objects in it share a property called 'type' with other objects in the array arr2:</p>
  
  <pre><code>[{d:1, e:2, type:1}, {a:1, b:2, type:2}]
  </code></pre>
  
  <p>How can I refer to the 'type' property to copy arr2's remaining properties into arr1? The desired result would be:</p>
  
  <pre><code>[{a:1, b:2, c:3, d:1, e:2 type:1}, {a:1, b:2, c:1, type:2}, {a:1, b:2, d:1, e:2, type:2}]
  </code></pre>
  
  <p>When I use something like angular.extend([], arr1, arr2), it only copies arr2's properties into the first 2 objects in arr1 (the 3rd object doesn't get love). What am I missing? Advanced thanks to all.</p>