From 2f8473cbdc10fa02c2d47633986d934db4b551df Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez <98057819+alejandroh9800@users.noreply.github.com> Date: Tue, 30 Aug 2022 01:14:16 -0700 Subject: [PATCH] Update calculator.js Cleaned up the for loop. --- calculator/calculator.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/calculator/calculator.js b/calculator/calculator.js index d45cc64..994b75b 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -23,9 +23,7 @@ const power = function(a, b) { const factorial = function(n) { if (n === 0) return 1; let product = 1; - for (let i = n; i > 0; i--) { - product *= i; - } + for (n; n > 0; n--) product *= n; return product; };