Advertisement
casion-aw8

aw8 JS code faktorial

May 15th, 2023
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. function hitungFaktorial(n) {
  2. if (n === 0) {
  3. return 1;
  4. }
  5. return n * hitungFaktorial(n - 1);
  6. }
  7.  
  8. console.log(hitungFaktorial(5)); // Output: 120
  9.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement