function Calc(val){ function multi(a,b){ return a*b; } function fun(v){ if(v<=1){ return 1; } //调用自身,递归 return multi(v,fun(v-1)); } return fun(val); } console.log("3的阶乘是:"+Calc(3));