sum([2, 3, 4], 1) should equal 2.
function sum(arr, n) {
// Only change code below this line
if (n <= 0)// if n is less than or equals to 0{
return 0 // should return zero
} else {
return sum(arr, n-1) + arr[n-1];
}
// Only change code above this line
}
sum([1],0);