JavaScript: How to sum values based on similar names in an array?
Thanks for taking the time! :)

Scenario:

    //array with names and items sold
    var data = [
    ["John", 15],
    ["Jenny", 17],
    ["Phyllip", 10],
    ["Beavis", 12],
    ["John", 10],
    ["Jenny", 2],
    ["Beavis", 5]];

I would like to search through this array, and create a summary Array that will add the items sold based on the name, resulting in:
new array:  
    ["John", 25],
    ["Jenny", 19], 
    ["Beavis", 17]   
    
and so on...

Thanks much!
JavaScript: How to sum values based on similar names in an array?
===

Thanks for taking the time! :)

Scenario:

    //array with names and items sold
    var data = [
    ["John", 15],
    ["Jenny", 17],
    ["Phyllip", 10],
    ["Beavis", 12],
    ["John", 10],
    ["Jenny", 2],
    ["Beavis", 5]];

I would like to search through this array, and create a summary Array that will add the items sold based on the name, resulting in:
new array:  
    ["John", 25],
    ["Jenny", 19], 
    ["Beavis", 17]   
    
and so on...

Thanks much!