Skip to content

Commit 26d3928

Browse files
new commit
1 parent 16ed8ea commit 26d3928

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

31_FactorialNumber.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function factorial(n) {
2+
// write your code here
3+
if (n === 0) {
4+
return 1;
5+
}
6+
return n * factorial(n - 1);
7+
}
8+
9+
let n = 4;
10+
console.log("The factorial of " + n + " is " + factorial(n));

0 commit comments

Comments
 (0)