Urgent help with recursion

please help im lost

Write a recursive function, sum(arr, n) , that returns the sum of the first n elements of an array arr .


function sum(arr, n) {

  // Only change code below this line

if (n <= 0) {

  return 1;

} else {

  return sum(arr, n - 1) + arr[n - 1]

}

  // Only change code above this line

}

if the sum is 0 return 1?

ive been fighting with this question for over an jour and its getting me confused about everything ive learned and if i knew what the answer is i could be able to understand it all

thanks @alkpwn3d i finally saw my mistake and now i understand the concept of recursion