From 54dd39860109614eb32f3f78460d3f8ed06090e2 Mon Sep 17 00:00:00 2001 From: BernH4 <62931413+BernH4@users.noreply.github.com> Date: Fri, 29 May 2020 12:44:38 +0200 Subject: [PATCH] Update calculator.js We dont need to return 1 if n = 0 because we set the return value (product) to 1 at the first line in the function so it can not be 0. If you did this for visual reasons thats fine i just wanted to say that. --- calculator/calculator.js | 1 - 1 file changed, 1 deletion(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index fe548f7..f76f04c 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -21,7 +21,6 @@ function power(a, b) { } function factorial(n) { - if (n == 0) return 1; let product = 1; for (let i = n; i > 0; i--) { product *= i;