I have two arrays that I create dynamically. The number of cells in both is the same (array.length
is the same, its like key and value association). Here they are:
barData.labels["Food", "Food", "Food", "Food", "Food", "Food", "Food", "Food", "Food", "Food", "Phone"]
barData.datasets[0].data["2", "8", "20", "200", "1", "300", "400", "500", "77", "7", "99"]
I need to check if there are duplicate values in barData.labels
, if so I need to sum the values in the barData.datasets[0].data
and delete them. For example if have 2 Food
entries I need to sum the values and then delete one of them.
How can I achieve that?