Update factorial.js

your function makes an infinite loop
This commit is contained in:
Fran Encabo 2022-11-26 08:36:02 +01:00 committed by GitHub
parent 565256088a
commit 166e1af2aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@
export default function factorial(number) { export default function factorial(number) {
let result = 1; let result = 1;
for (let i = 2; i <= number; i += 1) { for (let i = 2; i <= number; i ++) {
result *= i; result *= i;
} }