I want to merge and add the following 2D array:
var arr = [
["TWENTY", 20],
["TWENTY", 20],
["TWENTY", 20],
["TWENTY", 20],
["TEN", 10],
["FIVE", 5],
["ONE", 1],
["QUARTER", 0.25],
["QUARTER", 0.25],
["DIME", 0.1],
["DIME", 0.1],
["PENNY", 0.01],
["PENNY", 0.01],
["PENNY", 0.01],
["PENNY", 0.01]
];
Resulting in a 2D array that looks like this:
arr = [
["TWENTY", 80],
["TEN", 10],
["FIVE", 5],
["QUARTER", 0.50],
["DIME", 0.20],
["PENNY", 0.04]
];
Basically I'm adding up the number values and condensing the string values. I tried map, reduce, and for loops but this one has me stumped.