Basically I have 5 foodNames variables. I want to change their values dynamically. Something like this:
foodName1: '',
foodAmount1: '',
foodName2: '',
foodAmount2: '',
foodName3: '',
foodAmount3: '',
foodName4: '',
foodAmount4: '',
foodName5: '',
foodAmount5: '',
addFood() {
for (i=1; i < this.n; i++) {
this.list.push(this.foodName{i});
this.list.push(this.foodAmount{i});
this.foods.push(this.list);
this.list= [];
this.foodName{i} = '';
this.foodAmount{i} = '';
}
}
How can I achieve that?