Recursividad
unknown
javascript
5 years ago
102 B
9
Indexable
function sum(arr, n) {
if( n<=0) {
return n ;
} else {
return sum(arr, n-1) + arr[n-1]
}Editor is loading...
function sum(arr, n) {
if( n<=0) {
return n ;
} else {
return sum(arr, n-1) + arr[n-1]
}