I think that there's a bug in this lab

Tell us what’s happening:

Your code so far


function sum(arr, n) {
if (n <= 0) {
  return arr[0];
} else {
  return sum(arr, n - 1) + arr[n];
}
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15.

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

please tell us what’s happening
what’s going wrong? what do the failing tests say?

May look confusing, may not be what you expect, but why are you thinking there’s a bug here? Looks right to me.

Your code seems to pass, but the tests-passing pop-up gets stuck at 98%.

Maybe it is something with Safari? As said the code is passing, at least in Chrome and Firefox.