Skip to content

Commit 73bffc9

Browse files
authored
Merge pull request #226 from maddaladivya/master
Factorial function in Javascript
2 parents 6509314 + fbeeb31 commit 73bffc9

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)