diff --git a/src/functions/factorial.ts b/src/functions/factorial.ts index 52656df..d1cb514 100644 --- a/src/functions/factorial.ts +++ b/src/functions/factorial.ts @@ -22,6 +22,18 @@ solution * Provide your solutions below */ +solution + .owner('hasangenc') + .method('While loop') + .fn(function factorial(n): number { + let b = 1; + while (n > 1) { + b *= n--; + } + + return b; + }); + solution .owner('acanguven') .method('Recursive')