Source Code
// factorial - recursive
// 5! = 5*4*3*2*1
const fact = (n) => {
if(n<=1) return 1
else return n*fact(n-1)
}
const a = fact(8)
console.log(a)
Source Code
// factorial - recursive
// 5! = 5*4*3*2*1
const fact = (n) => {
if(n<=1) return 1
else return n*fact(n-1)
}
const a = fact(8)
console.log(a)