I Have an array [[Food , quantity]]
with duplicated values and i want to add the quantities of the same food in the array but i can't seem to find a way to do that
I want to do this using JavaScript and the array looks like this:
[
["Burger", 5],
["Pizza", 10],
["Coke", 13],
["Burger", 7],
["Soda", 10],
["Pizza", 4],
["Burger", 12]
]
and i want the result to be like:
[
["Burger", 24],
["Pizza", 14],
["Coke", 13],
["Soda", 10]
]
And then I want to display the result on a table