title: Finding Max Sum in Array of Credit Card Numbers
body: <p>I am interested in finding the credit card number whose digits sum to the largest number. If  more than one has the same largest sum of digits, I want the last one in the list with that sum. </p>
  
  <p>I am trying to write a single function that takes one argument. That argument will be an array  of credit card numbers. Assume the array can have any number of credit card numbers and each one is a string of digits and dashes. The function should return the credit card number that has the largest sum of digits.  </p>
  
  <p>Here is what I have so far-</p>
  
  <pre><code>var creditCardNumbers = ['5865-2600-5889-0555', '4779-598666-3666', '4252-278553-7978' ,'4556-4242-9283-2260'];
  
  var sums = creditCardNumbers.map(function(f) {
  return f.match(/\d/g).reduce(function(sum, num) {
       return sum + parseInt(num);
  }, 1);
  });
  var maxSum = Math.max.apply(Math, sums);
  
  
  console.log("totalSums = " + (sums) );
  console.log("maxSum = " + maxSum );
  console.log("Number with the highest sum: " + (sums.creditCardNumbers));
  //This last console.log does not work
  </code></pre>
  
  <p>I am having trouble returning the corresponding credit card number with highest sum. If anyone has advice on how to achieve this problem their own way that's great. Thanks in advance!</p>