Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sum of digits in a whole number javascript

sum = 0;
while (value) {
    sum += value % 10;
    value = Math.floor(value / 10);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #digits #number #javascript
ADD COMMENT
Topic
Name
5+4 =