Being troubled by 'Replace Loops using Recursion'

‘Replace Loops using Recursion’ in BASIC JAVASCRIPT is way too advanced topic to understand for beginners- i think. This topic may discourage many learners in their learning path. I would like to draw freeCodeCamp’s attention to this complexity.


If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

if you want to report this as a bug,

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

Recursion is hard but critical. It’s hard no matter where it is in the curriculum. Having just started going through the curriculum myself to learn how different JavaScript is from C, I found the content and location appropriate from a pedagogical point of view. The learner has to basically copy the given example, swapping a * for a +, but it requires the learner to think about the purpose of the function calls and conditional statement.

I am sure there are things that can probably be improved about the lesson though.

Just my $0.02.

I understand the essence of recursion but still can’t beat out how the problem in reference works. If you could break it down that’d be cool. I think what I personally misunderstand is how this use case is iterating through each index of the array, n, and adding that to the index, n-1, and returning the total value of the summation of each index of the array. As of now it just seems like its “automagic”. My explanation of misunderstanding feels like its redundant but I’m just trying to give more information for anyone who can help, I’m simply lost on this one.

1 Like

Have you tried running some of the sample code on


Just did, but I’ve never used it before. Doing the live run didn’t really help. It just pointed out the global frame.

If you try something simple like

function countUp(n) {
  if (n < 1){
  } else {
    countUp(n - 1);


you can click Visualize Execution and then use the < Prev and Next > buttons to see how the code executes. The global frame is only the first step.

1 Like

This really did help!!!
Amazing! Thank you!

I see that advance topic as a test for PATIENCE and PERSEVERANC.

that is a good website, but so hard to understand how these codes work:

btw, thanks for giving us that website/link