Skip to content

Commit fbeeb31

Browse files
committed
Factorial function in Javascript
1 parent 6509314 commit fbeeb31

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

factorial/factorial.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function factorial(n) {
2+
if (n === 0) {
3+
return 1;
4+
}
5+
return n * factorial(n - 1);
6+
}
7+
console.log(factorial(100));

0 commit comments

Comments
 (0)