diff --git a/src/index.js b/src/index.js index f16abeb..2175e4c 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,7 @@ const factorial = (number) => { - - } + if (number < 0) return; + if (number === 0) return 1; + return number * factorial(number - 1); +}; - module.exports = factorial; \ No newline at end of file +module.exports = factorial;