Recursion not giving the expected output

Tell us what’s happening:
Hello, I am trying to understand this recursion, but I am just not getting it. Even when I used the example the result was 6. I cannot seem to figure out why I am not getting 5 to pass this challenge. Thank you.
What I ended up doing was

      return sum(arr, n-1) * (arr[n])-1;
    }
but I am not sure if that is the correct way. I also show that I am only 98% when I submitted the challenge. 

**Your code so far**
      
```js

function sum(arr, n) {
// Only change code below this line
  if (n <= 0) {
      return arr[0];
  }
  else {
    return sum(arr, n - 1) * arr[n];
  }
// Only change code above this line
}


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.

Challenge: Replace Loops using Recursion

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion

so, you are creating a function to sum the numbers in an array, but you are… multiplying?

Ummm… No? :lying_face:
I feel foolish. Thank you. I have not been on here for a while, and I was just plain not thinking. Thanks for pointing out my foolishness, I think I will just go away now. Thanks again!

I am still a bit confused on recursions, but thank you for pointing out my error.

try looking at the various recursion examples with this tool:
http://www.pythontutor.com/javascript.html

Thank you very much. I shall.