tradeArray = ['ITD', 'TND', 'TRD']
trade = []
this.tradeArray.map(val => this.trade.push({
"value": val,
"checked": false,
}))
I have this snippet and I want to add one more field to trade array, counter.
For example, if I have count = [3, 5, 2] I want to obtain:
0: {value: "ITD", checked: false, counter: 3}
1: {value: "TND", checked: false, counter: 5}
2: {value: "TRD", checked: false, counter: 2}
I hope by this example you will understand what I want to obtain. I tried something like this:
count = [3, 5, 2]
this.tradeArray.map(val => this.trade.push({
"value": val,
"checked": false,
"counter": this.count.map(val => val)
}))
but this will give me
0: {value: "ITD", checked: false, counter: [3, 5, 2]}
1: {value: "TND", checked: false, counter: [3, 5, 2]}
2: {value: "TRD", checked: false, counter: [3, 5, 2]}
How can I modify in order to obtain what I want? Thank you for your time!
countITD = 3, countTND = 5, countTRD = 2ITD,TRDandTNDappear in a list.