From 924066bb0cddf1a6e09183b12bf612b0b2f9229a Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Sat, 2 Jun 2018 09:40:32 +0300 Subject: [PATCH] Do minor optimisations to factorial function. --- src/algorithms/math/factorial/factorial.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/math/factorial/factorial.js b/src/algorithms/math/factorial/factorial.js index 194fc898..6c717d05 100644 --- a/src/algorithms/math/factorial/factorial.js +++ b/src/algorithms/math/factorial/factorial.js @@ -5,7 +5,7 @@ export default function factorial(number) { let result = 1; - for (let i = 1; i <= number; i += 1) { + for (let i = 2; i <= number; i += 1) { result *= i; }