I have a requirement where i need to find sum the values of amt in different objects having same name. Below is the code snippet
traveler = [
{ description: 'Senior', Amount: 50},
{ description: 'Senior', Amount: 50},
{ description: 'Adult', Amount: 75},
{ description: 'Child', Amount: 35},
{ description: 'Infant', Amount: 25 },
];
Here i want to caluclate the total sum of Amount in different objects with same description. eg: object 0 and 1 contains same description 'Senior' so the total amt is 100
How to achieve this in angular2?
Should i use inner forloops or is there any better approach? Please help me