Fix return value of recursive factorial function
While the previous return functioned the same (because it was calling another factorial function), it was not recursive. All credit still to ThirtyThreeB, just thought this might confuse some people and was worth fixing!
This commit is contained in:
parent
b14ac4ea17
commit
b030e9a66b
1 changed files with 1 additions and 1 deletions
|
@ -33,7 +33,7 @@ function recursiveFactorial(n) {
|
|||
if (n===0){
|
||||
return 1;
|
||||
}
|
||||
return n * factorial (n-1);
|
||||
return n * recursiveFactorial (n-1);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in a new issue