mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
Update factorial.js
your function makes an infinite loop
This commit is contained in:
parent
565256088a
commit
166e1af2aa
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user