Skip to content

Commit 8d3f5c3

Browse files
authored
removed redundant if check, fix formatting
1 parent fdf5fba commit 8d3f5c3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

maths/double_factorial_iterative.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
*/
1919
const DoubleFactorialIterative = (n: number) => {
2020
if(n < 0) throw new RangeError("The number needs to be non-negative")
21-
if(n === 0) return 1;
22-
let doubleFactorial = 1;
21+
let doubleFactorial = 1
2322

2423
for(let i = n; i > 0; i -= 2)
25-
doubleFactorial *= i;
24+
doubleFactorial *= i
2625

27-
return doubleFactorial;
26+
return doubleFactorial
2827
}
2928

30-
export { DoubleFactorialIterative };
29+
export { DoubleFactorialIterative }

0 commit comments

Comments
 (0)