Do I need to understand recursion right now?

Hey campers!

I’m pretty new. I did the Responsive Web Design section of the curriculum, and I’m working through the first part of the Javascript section. So far I’ve made sure that I deeply understand everything before moving on. But I’m really struggling with recursion. I got through the recursion challenge where you replace loops with recursion by reading a Javascript book I have, reading articles online, and watching Youtube videos and reading threads here. I mostly understood that challenge, but I didn’t feel like I had a robust understanding of recursion itself. The Basic Javascript section ends with two more challenges about recursion, and I’m struggling again.

Can you tell me what to do? Should I be seeking out additional resources to understand this better? (Can you suggest resources?) Or is this something I can have just a very basic understanding of/still be a bit confused by and move past for now? I’m sure i can use the hints and videos and stuff on FCC to get through the challenges, but I feel like I’ll come out the other end with still only a limited grasp of recursion. So I’m wondering if I need to stop here and do some outside learning before moving on, or just accept that I’ll learn recursion more along the way (maybe doing the Javascript projects will help me learn?)

Thanks for your input!!!

Hi @lawrencek1992!

Welcome to the forum!

So the goal for each of these sections is not to have complete understanding of all of the concepts but rather a basic understanding.

As you move through the section, the concepts will get trickier and don’t feel like you need to spend days try to have a deep understanding. There will be plenty of chances to practice these concepts through repetition and projects.

Recursion is a tricky topic. It just takes time and practice to get a better understanding.
You could look into these resources on recursion if you haven’t already.

So aim for basic understanding for these topics.
It is your first programming language so it just takes time.

Keep moving through the curriculum.

1 Like

Okay, this is super helpful! Thank you for the resources–I will definitely check them out. But it’s reassuring to hear that I don’t need a deep understanding and will have future opportunities to practice and reinforce concepts. I’ll just do my best to get through the challenges at hand, read resources you’ve shared, but not let a basic understanding keep me from feeling like I can’t move on.

Also as a teacher, I think freeCodeCamp is an amazing resource. I’m so impressed with what has been put together here. I’m grateful to have a resource and a community that helps me learn new skills without having to go back to college and incur more student loan debt!

Thank you!

1 Like

Hi @lawrencek1992,
Recursion is tricky, don’t worry about it now.
You get better by writing more code later.
Recursion is not something that often used, but understanding the concept is good.

So if you got stuck, you can asked for help here. We will love to help.
If you need to visualize your code, this is a good site to ‘see’ what your code is doing pythontutor.com

If it’s not keeping you from completing a specific project I’d keep moving forward until it’s actually an obstacle. When you have a concrete example of how it’s an issue, it’ll be easier to comprehend. It’s basically an infinite loop of a program calling itself and more of an anti-pattern to be aware of

function namedIt (){
//because it just keeps calling itself it eats up all your memory and ties the processor up until it crashes.
namedIt();
}

1 Like

It seems like most people struggle with recursion. So what you’re experiencing is probably normal. It’s one of those topics you just have to revisit and practice with from time to time until it sinks in. I still don’t completely get it, either. I kind of tend to see code problems in mental pictures and it’s harder for me to visualize recursive problems than other types.

Don’t worry about it in the immediate future, but it would be good to master in the long term.

It really only becomes important with certain types of data structures, most of which aren’t typical in most web dev jobs, especially on the front end. I used one only once. But they are good to know and they occasionally on interviews.

And they are confusing. Just keep at it and one day it will start to click. But don’t sweat it.

Man that sounds like my experience. I read articles and books with various different narrative metaphors and graphics to try to visually represent them. While I can sort of conceptually understand what they are doing (only sort of, mind you), as soon as I look at code for it, my mind acts like we are reading another language, and it’s a painstaking process to understand what each line of code is doing. Even when people explain it, I have to read the explanation and code side by side multiple times to get it. I just haven’t had anywhere near this struggle with any of the other concepts so far (granted Javascript seems a lot more mentally demanding than the html and css was).

1 Like

That’s because html and css are markup languages not programming languages.

It will take a while to get used to how programming works. I was the same way when I first started with javascript a few months ago. But over time, I was able to start building projects with it.

So it is normal.

1 Like

And for the record, I know more than a few professional developers that struggle with recursion. (Shockingly, I met a junior developer that had no idea what it was.) Don’t let your struggles fool you into thinking that you can’t do this. It would be like a beginning skateboarder giving up because they have trouble with a 720.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.