factorial using for loop in javascript explanation code example
Example: factorial program in javascript
function fact(N){
if(N <= 1){
return "1";
}
else
{
return N * fact(N-1);
}
}
fact(5);
function fact(N){
if(N <= 1){
return "1";
}
else
{
return N * fact(N-1);
}
}
fact(5);