I am newbie.
I want to make small app which will calculate the sum of all the digits of a number.
For example, if I have the number 2568, the app will calcul
How about this simple approach using modulo 9 arithmetic?
function sumDigits(n) { return (n - 1) % 9 + 1; }