mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 23:21:18 +08:00
Do minor optimisations to factorial function.
This commit is contained in:
parent
88bd8d7044
commit
924066bb0c
@ -5,7 +5,7 @@
|
|||||||
export default function factorial(number) {
|
export default function factorial(number) {
|
||||||
let result = 1;
|
let result = 1;
|
||||||
|
|
||||||
for (let i = 1; i <= number; i += 1) {
|
for (let i = 2; i <= number; i += 1) {
|
||||||
result *= i;
|
result *= i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user