Skip to content

Commit

Permalink
Added Recursion JS
Browse files Browse the repository at this point in the history
  • Loading branch information
khianvictorycalderon committed Dec 13, 2024
1 parent 5406461 commit 18b6c76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Recursion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

function factorial(number) {
if(number == 0 || number == 1) {
return 1;
} else {
x = number * factorial(number - 1);
return x;
}
}

console.log(factorial(5));

0 comments on commit 18b6c76

Please sign in to comment.