Created
October 5, 2015 21:32
-
-
Save Deliaz/fc02df419d9ac84d210e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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