I'm doing the practice of showing a large number with factorial. The problem is It always round automatically when the result is too large. Here is an example:
function extraLongFactorials(n) {
const rs = [...Array(n)].reduce((a, b, i) => a*(i+1), 1);
console.log(rs);
}
extraLongFactorials(25);
The result of the above code is:
1.5511210043330986e+25
When the expected output is
15511210043330985984000000
I try with toFixed() and toLocaleString('fullwide', {useGrouping: false}) but both gave the wrong output.
15511210043330986000000000
Does anybody know how to handle this situation?