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)
You might get the card with maximum sum like this;
var cards = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260'], cardSums = cards.map(c => c.split("-").reduce((p,c) => +p + +c)), maxCard = cards[cardSums.indexOf(Math.max(...cardSums))]; console.log(maxCard);