title: How to add property to each object of an array in typescript.?
body: <p>i need to add property to each object an array . i have searched a lot , <a href="https://stackoverflow.com/questions/26410640/adding-property-to-each-object-of-an-array-independently-with-angularjs-angular">got this</a>, but this is AngularJs. I have tried below but not works. Any help appreciated </p>
  
  <pre><code> export class ThreeComponent implements OnInit {
   people = [];
  
   ngOnInit() { 
     this.people = [
     {'name': 'person 1', 'product': 'Medicine 1'},
     {'name': 'person 2', 'product': 'Medicine 2'},
     {'name': 'person 3', 'product': 'Medicine 3'},
     ]
    this.people.push({'total' : '2'})
    console.log(this.people)
    }
   }
  
  results look like this:
  (4) [{…}, {…}, {…}, {…}]
   0:{name: "person 1", product: "Medicine 1"}
   1:{name: "person 2", product: "Medicine 2"}
   2:{name: "person 3", product: "Medicine 3"}
   3:{total: "2"}
   length:4
   __proto__:Array(0)
  
  expected result should be:
  (3) [{…}, {…}, {…}]
   0:{name: "person 1", product: "Medicine 1", "total": "2"}
   1:{name: "person 2", product: "Medicine 2", "total": "2"}
   2:{name: "person 3", product: "Medicine 3", "total": "2"}
   length:3
   __proto__:Array(0)
  </code></pre>