title: Replacing objects inside Angular's forEach()
body: <p>I have an array of objects and an <code>forEach()</code>, like this one:</p>
  
  <pre><code>$scope.things = [
      {x: 2},
      {x: 4},
      {x: 5}
  ];
  
  angular.forEach($scope.things, function(thing) {
  
      //Pick one of the lines at a time
  
      //thing.x += 10;         // &lt;--- works
      //thing.k = thing.x + 1; // &lt;--- works
      //thing = {k: thing.x + 10, o: thing.x - 1};  // &lt;--- doesn't work
  
      //
  });
  
  console.log($scope.things);
  </code></pre>
  
  <p>And by <code>"works", "works" and "doesn't work"</code> I mean:</p>
  
  <ul>
  <li><code>x</code> is added 10, and final array looks as <code>{x: 12}, {x: 14}, {x: 15}</code></li>
  <li><code>k</code> is created, and final array looks as <code>{x: 2, k: 3}, {x: 4, k: 5}, {x: 5, k: 6}</code></li>
  <li><code>thing</code> itself isn't replaced, and the array of <code>things</code> looks exactly like at the beginning.</li>
  </ul>
  
  <p>My questions are:</p>
  
  <ul>
  <li>Why is this happening?</li>
  <li>Is that the expected behavior?</li>
  <li>How can I completely replace each <code>thing</code>?</li>
  </ul>