mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-20 18:43:43 +08:00
Remove live code & console.log, leave examples as comments (ProjectEuler, Recursive).
This commit is contained in:
@ -3,14 +3,9 @@
|
||||
// 5! = 1*2*3*4*5 = 120
|
||||
// 2! = 1*2 = 2
|
||||
|
||||
const factorial = (n) => {
|
||||
export const factorial = (n) => {
|
||||
if (n === 0) {
|
||||
return 1
|
||||
}
|
||||
return n * factorial(n - 1)
|
||||
}
|
||||
|
||||
// testing
|
||||
console.log(factorial(4))
|
||||
console.log(factorial(15))
|
||||
console.log(factorial(0))
|
||||
|
Reference in New Issue
Block a user