function sum(arr, n) {
// Only change code below this line
function sum(arr, n) {
if(n <= 0) {
return 0;
} else {
return sum(arr, n -1) + arr[n-1];
}
}
// Only change code above this line
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15.
This sort of thing most often happens when copy-pasting guide post solutions into your code. Recursion is a good check point of your level of understanding for function calls, return values, and scope, so I’d make sure that you can do it without looking at the solution.