Need help with Basic JavaScript: Replace Loops using Recursion

I understand the initial if statement. I don’t understand the else statement. What exactly is it doing? I need an in depth explanation. I know it’s a lot to ask but sometimes i come across a lesson and the best way for me to understand is explanations from other people. Thank you!!

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

There have been a few really good and in-depth discussions of how recursion works here on the forum, where people have drawn diagrams, shared their favorite articles and videos, and stepped through the process of some of the freeCodeCamp recursive functions. I’m not trying to discourage you from asking questions, but since you are generally asking for a broad explanation, I suggest reading through past explanations (the forum search feature is very good) so that you can ask more specific questions about the parts that don’t make sense to you.

Here are a couple: