Project Euler 20 - Factorial Digit Sum - Solved with JavaScript

The 20th Project Euler problem - Factorial Digit Sum - is stated as follows. Find the sum of the digits in the number 100!

// Recursive function using BigInt to get n factorial.
const factorial = (n) => n <= 1 ? BigInt(n) : BigInt(n) * BigInt(factorial(--n));

// Convert the number to a string.
const sumDigits = n => n.toString()
    // Split the string on every char.
    .split('')
    // Convert all chars to ints.
    .map(x => parseInt(x))
    // Sum all ints.
    .reduce((a,b) => a + b);

// Get 100 factorial.
const f100 = factorial(100);

// Sum the digits.
const result = sumDigits(f100);