Replace Loops using Recursion not passing

Tell us what’s happening:
The code that checks if it is a recursion solution doesn’t work.

Your code so far


function sum(arr, n) {
// Only change code below this line
if (n <= 0) {
return arr[0];
}
return arr[n] + sum(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:69.0) Gecko/20100101 Firefox/69.0.

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

the issue seems to be only with firefox on my end not sure what is happening

}else{
return arr[n]+sum(arr, n-1);
}

i runned the test and it passed try opening chrome our another browser

It looks like this bug has been reported and a fix is in review:

A fix for this has reached the production platform, please check. Happy contributing.

1 Like