Update calculator.js

We dont need to return 1 if n = 0 because we set the return value (product) to 1 at the first line in the function so it can not be 0.
If you did this for visual reasons thats fine i just wanted to say that.
This commit is contained in:
BernH4 2020-05-29 12:44:38 +02:00 committed by GitHub
parent 3b51e5dbef
commit 54dd398601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 1 deletions

View File

@ -21,7 +21,6 @@ function power(a, b) {
}
function factorial(n) {
if (n == 0) return 1;
let product = 1;
for (let i = n; i > 0; i--) {
product *= i;