Skip to content

Instantly share code, notes, and snippets.

@Deliaz
Created October 5, 2015 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deliaz/fc02df419d9ac84d210e to your computer and use it in GitHub Desktop.
Save Deliaz/fc02df419d9ac84d210e to your computer and use it in GitHub Desktop.
function getNumerology(num) {
var strNum = num.toString();
var strLen = strNum.length;
var sum = 0;
for(var i = 0; i < strLen; i++) {
sum += parseInt(strNum[i]);
}
return sum.toString().length < 2 ? sum : getNumerology(sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment