I would need some help with this code bellow.
function main(n) {
factCounter = 1;
for (let i = n; i > 0; --i) {
factCounter *= i;
}
let numArr = BigInt(factCounter).toString().split('');
let sum = 0;
numArr.forEach((el) => (sum += +el));
console.log(sum);
}
main(100);
It is solution for Project Euler #20, where i need to get the sum of all digits from 100! (factorial). But from some reason it gives me wrong answer. My output is 734, but expected output should be 648.