Skip to content

Instantly share code, notes, and snippets.

View SMXaS's full-sized avatar
💡
Mars

Arnoldas Jurkus SMXaS

💡
Mars
View GitHub Profile
@joshkautz
joshkautz / digitSum.js
Created September 4, 2016 14:35
CodeFights - JavaScript code to calculate the sum of all digits in an integer
function digitSum(n) {
var sum = 0;
var string = n.toString();
for(i=0; i < string.length; i++){
sum = sum + parseInt(string.substring(i, i+1));
}
return sum;
}