Recursividad

mail@pastecode.io avatar
unknown
javascript
3 years ago
102 B
1
Indexable
Never
function sum(arr, n) {
  if( n<=0) {
    return n ;
  } else {
    return sum(arr, n-1) + arr[n-1]
  }