循环
function sumNumber(min, max) {
let result = 0
for (let i = min+1; i<max;i++){
result += i
}
return result
}
递归
function sumNumber2(min, max) {;
return min+1 < max ? (min+1) + sumNumber2(min+1, max) :0
}
欢迎分享,转载请注明来源:内存溢出
循环
function sumNumber(min, max) {
let result = 0
for (let i = min+1; i<max;i++){
result += i
}
return result
}
递归
function sumNumber2(min, max) {;
return min+1 < max ? (min+1) + sumNumber2(min+1, max) :0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)