Skip to content

Commit 51d3aa3

Browse files
committed
update
1 parent a5085c6 commit 51d3aa3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/recursion.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ const nFactorial = (n) => {
3636

3737
// // version 2.1 √
3838
// return (n === 1) ? n : n * nFactorial(n - 1);
39+
40+
// // version 3 non-recursive
41+
// function nFactorial (num) {
42+
// let factorial = 1;
43+
// for (let i = 1; i <= num; i++) {
44+
// factorial *= i;
45+
// }
46+
// return factorial;
47+
// }
3948
};
4049

4150
const checkMatchingLeaves = (obj) => {

0 commit comments

Comments
 (0)