diff --git a/Maths/Factorial.js b/Maths/Factorial.js index 29b416a67e..b68e6e27df 100644 --- a/Maths/Factorial.js +++ b/Maths/Factorial.js @@ -21,11 +21,8 @@ const calcFactorial = (num) => { if (num === 0) { return 'The factorial of 0 is 1.' } - if (num < 0) { - return 'Sorry, factorial does not exist for negative numbers.' - } - if (!num) { - return 'Sorry, factorial does not exist for null or undefined numbers.' + if (!num) || (num < 0) { + return 'Sorry, factorial does not exist for null or undefined or negative numbers.' } if (num> 0) { const range = calcRange(num)