function factorial(n){
if( n === 1) return n;
return n * factorial(n-1);
}
function factorial(n,total){
if( n === 1 ) return total;
return factorial(n-1,n*total);
}
factorial(5,1); //输出120
function factorial(n){
if( n === 1) return n;
return n * factorial(n-1);
}
function factorial(n,total){
if( n === 1 ) return total;
return factorial(n-1,n*total);
}
factorial(5,1); //输出120