function factorial if return factorial n-1 else return console log fac

1
2
3
4
5
6
7
8
function factorial (n) {
if (n != 1) {
return n * factorial(n-1);
else {
return 1;
}
}
console.log (factorial(20));