// 实现一个5的阶乘
function factorial(n, acc = 1) { console.log(`n=${n};acc=${acc}`) if(n <= 1) return acc return factorial(n - 1, n * acc) } console.log(factorial(5))
// 实现一个5的阶乘
function factorial(n, acc = 1) { console.log(`n=${n};acc=${acc}`) if(n <= 1) return acc return factorial(n - 1, n * acc) } console.log(factorial(5))
转载于:https://www.cnblogs.com/dwb91/p/8990979.html