Recursividad
unknown
javascript
4 years ago
102 B
5
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] }