var arr = [1,3,2,7,5,9,11];
function sum(arr){
var total = 0;
var fun = function(arrs){
if(arrs.length > 0){
total += arrs.pop();
fun(arrs);
}
}
fun(arr);
return total;
}
时间: 2024-12-07 08:38:05
var arr = [1,3,2,7,5,9,11];
function sum(arr){
var total = 0;
var fun = function(arrs){
if(arrs.length > 0){
total += arrs.pop();
fun(arrs);
}
}
fun(arr);
return total;
}