I have figured out how to calculate the value of numbers from a single string, using as an example..
var sum = \"13-2-10-7-3\".split(\'-\').reduce(function(x, y)
Its not the most performant, but its simple and quick
var ccs = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260']
// FSFL = F*Simple For-Loop
var sum = (a, b) => a + b;
var largestSum = 0;
var largestSumLastIdx = 0;
for (let i = 0; i < ccs.length; i++) {
let s = ccs[i].split(/-|/).map(Number).reduce(sum, 0);
if (s >= largestSum) {
largestSum = s;
largestSumLastIdx = i;
}
}
console.log("The winner is: " + ccs[largestSumLastIdx])