Numerology Calculator
map and reduce are tailor made for problems like this.

To understand the while loop in the final version of the code at the bottom of this post, it may help to consider a "longhand" version that does the same thing:

// this sets the answer we seek to the sum of all the digits
// of every number passed in via the array
finalAnswer = addDigits(combinedDigits);

// but since this sum may still be larger than a 1 digit 
// number (ie, 10 or more), we need to continue the summing
// the digits until we end up with a single digit number
while ( finalAnswer &gt; 9 ) {
  // this converts an integer to a string
  combinedDigits = '' + finalAnswer;
  // this sums the digits again
  finalAnswer = addDigits(combinedDigits);
}


Here's the final, complete version, with the more compact while loop.  We are simply combining some of the steps above.

function addDigitsRecursively(arr) {

  var combinedDigits = arr.join(''), finalAnswer;

  while ( (finalAnswer = addDigits(combinedDigits)) &gt; 9 )
    combinedDigits = '' + finalAnswer;

  function addDigits(str) {
    return str.split('').map(function(n) {return parseInt(n)})
                        .reduce(function(a, b){return a+b;})
  }

  return finalAnswer;
}

var value = addDigitsRecursively([13, 11, 1938]);
document.body.innerHTML = value;