I understand there’s better ways to be doing what I’m doing, but I’m genuinely confused to why the for loop isn’t running at all.
function intArray(x) {
let a = x.toString();
let b = a.split("");
return b;
}
function digitalRoot(n) {
var b = intArray(n);
console.log(b);
let d = 0;
for (var i = 0; i > b.length; i++) {
d += parseInt(b[i]);
console.log("for loop doing anything?");
}
return d;
}
// Desired output (for now):28
let testNumber = 73279;
console.log(digitalRoot(testNumber));