Basic JavaScript - Replace Loops using Recursion

Tell us what’s happening:
Describe your issue in detail here.
So im struggling to understand why the test case sum([2, 3, 4, 5], 3) = 9

i get that we are adding the numbers at the index which is n.
but why does the index not start at 0, how-come the 4 in the array is the at the third index?

i.e 0 + 2 + 3 + 4 =9

i’ve searched the topics on this and think i grasp the recursion however if someone could please help explain whats happening in this code
Your code so far

function sum(arr, n) {
  // Only change code below this line
    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 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0

Challenge: Basic JavaScript - Replace Loops using Recursion

Link to the challenge:

Take another look at the second return. It’s not the element from the index n added, but n - 1. Therefore for n === 3, first added element will have index 2.

array [2, 3, 4, 5]
index  0  1  2  3

Ohhh so we completely skip the third index because of the n -1 i didnt understand that the subtraction was happening before the adding i see thanks a bunch.