Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to find factorial of a number using Recursion in javascript

// how to find factorial of a number using Recursion in javascript
function factorial(n) {
  if(n<=1){
      return 1;
  }else{
      return n * factorial(n - 1);
  }
}
console.log(factorial(5));
// output : 120
 
PREVIOUS NEXT
Tagged: #find #factorial #number #Recursion #javascript
ADD COMMENT
Topic
Name
7+5 =