Recursion: What level of difficulty to expect with JavaScript

I am doing the freecodecamp training. I did the HTML, CSS and now the JavaScript. Everything was going well until I got to the end with recursion.
For now I must admit that I do not really understand.
I understand that is a function that calls itself but I can’t see myself finding such a function on my own, so I’m worried.

So I wonder … do I have the necessary facilities to be a web developer?

Is it normal for a beginner not to understand?
Is it the maximum difficulty or worse afterwards?

1 Like

programming is hard, and you just met one of the hardest concepts around.

As difficulty goes, it varies, also it depends on what you mean by difficult, there will be always something to look up, to try to understand better

Thank you fore that answer…as a student of Javascript I appreciate this answer :wink:

Think of it as if you have boxes or Matryoshkas, nested from larger to smaller.
When you call a recursive function, you open the largest box, which opens the smaller and so on, until the smallest box doesn’t contain any boxes, but returns you a value.
Then you close the boxes backwards, and every time you close a box, you can modify the value you’ve got (every box has an instruction about what to do with value, thats what you write in your code). When you close the last largest box, you get the modified value.

You don’t have to be great at recursion to be a web developer. Sure it’s part of the overall JS knowledge you are expected to at least know about and preferably be able to use in if nothing else a simple use case. But you can create a hundred web apps and never need or use recursion. It can be handy at times for certain problems but you are very unlikely to fail as a web developer just because you aren’t great at recursion.

Does this mean you shouldn’t try to learn it? No, but I wouldn’t lose too much sleep over it.

https://www.youtube.com/results?search_query=recursion

Yeah, a lot of developers struggle with recursion. It’s a confusing thing. Just work at it and know that it will sink in eventually. But don’t freak out about it. I find for things like this, that videos are useful, checkout youtube.

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