Big Numbers Fatorial JS
var factorial = function(n){n=BigInt(n);return (n==0n||n==1n)?1n:factorial(n-1n)*n;}
//can be print this way
console.log( factorial(n) );
HxnRxa
var factorial = function(n){n=BigInt(n);return (n==0n||n==1n)?1n:factorial(n-1n)*n;}
//can be print this way
console.log( factorial(n) );
const factorial = n => n <= 1 ? 1 : n * factorial(n - 1);
// Examples
factorial(2); // 2
factorial(3); // 6