From b030e9a66b85ec5817eb1ec6f5c04142674d8220 Mon Sep 17 00:00:00 2001 From: bchalman <40923964+bchalman@users.noreply.github.com> Date: Sun, 19 Aug 2018 13:02:55 -0700 Subject: [PATCH] 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! --- calculator/calculator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index 660e58a..6fa7dd9 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -33,7 +33,7 @@ function recursiveFactorial(n) { if (n===0){ return 1; } - return n * factorial (n-1); + return n * recursiveFactorial (n-1); } module.exports = {