js-递归
2019-08-16 本文已影响0人
AssertDo
//递归
function getSum(x){
if(x == 1){
return 1;
}
return x + getSum(x-1);
}
console.log(getSum(5));