I need to know how to add array in the Angular component (TypeScript)
addCostCenter(i){
this.costCenter.push(i);
}
Every time I click, there will be a function that will add an array; I will have many one-dimensional arrays.
I need to know the way in which I can add all the arrays that are inside and that if the sum gives more than 100, an error appears; or if it gives less than 100, an error. The sum of all the arrays that you add must be 100.
In conclusion; I want to know how you can add the array and how to make it so that it says that the sum must be 100. If it is more or less than 100; I get an error.