Guest User

Untitled

a guest
Oct 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. /**
  2. Challenge
  3. Factorial
  4.  
  5. Sample Test Cases
  6.  
  7. Input: 1
  8. Output: 1
  9.  
  10. Input: 4
  11. Output: 24
  12.  
  13. Input: 9
  14. Output: 362880
  15. */
  16.  
  17. function FirstFactorial(num) {
  18. if (num === 0) {
  19. return 1;
  20. } else {
  21. return num * FirstFactorial(num - 1);
  22. }
  23. }
Add Comment
Please, Sign In to add comment