title: How to manipulate the value in array in model($scope) in angular.JS?
body: <p>Excuse me I have to ask a stupid question.</p>
  
  <pre><code> $scope.taxInFiveCity = [{
          id: 1,
          city: 'Taipei',
          tax: 32530459
      }, {
          id: 2,
          city: 'NewTaipei',
          tax: 19232016
      }, {
          id: 3,
          city: 'Taichung',
          tax: 12150909
      }, {
          id: 4,
          city: 'Tainan',
          tax: 8322458
      }, {
          id: 5,
          city: 'Kaoshung',
          tax: 16069937
      }, {
          id: 6,
          city: 'Total',
          //The following  is the main part of my difficulty//
          tax: $scope.taxInFiveCity[0].tax + $scope.taxInFiveCity[1].tax + $scope.taxInFiveCity[2].tax + $scope.taxInFiveCity[3].tax + $scope.taxInFiveCity[4].tax
          //
      }];
  </code></pre>
  
  <p>The above is my code in the <code>controller.js</code></p>
  
  <p>I create an array in the model of the MVC framework of AngularJS to store the taxes of estate in the main five cities in Taiwan.</p>
  
  <p>Then I want to make the last element in the array be the total. How can I modify my code to calculate the sum of the attributes in the objects in the array and store the sum value in the last <code>objects(total)</code> in the <code>$scope</code>?</p>