1// METHOD ONE
2const factorialNumber = num => {
3 let factorials = []
4 for(let i = 1; i <= num; i++) factorials.push(i)
5 return factorials.reduce((acc , curr) => acc * curr, 1)
6}
7
8// METHOD TWO
9const factorialNumber = num => {
10 let factorial = 1, i = 1
11 while(i <= num){ factorial *= i; i++ }
12 return factorial
13}
14// METHOD THREE
15function factorialNumber(num) {
16 if(num < 1) return 1
17 else return factorialNumber(num - 1) * num
18}