I understand that the problem is in the fact function, as I can't print the input at some point, but how can I fix it?
function factDigits(n) {
let factorial = fact(BigInt(n));
return digits_count(factorial);
}
function fact(input) {
if(input === 0n) {
return 1n;
}
return input * fact(input-1n);
}
function digits_count(n) {
let count = 0;
if (n >= 1n) ++count;
while (n / 10n >= 1n) {
n /= 10n;
++count;
}
return count;
}