Recursion is one of the most confusing topics you will run into when you start to learn programming. The idea of a function calling itself just seems strange and keeping track of the call stack seems impossible. In this video I will be breaking down recursion in as simple terms as possible, and then going through three in depth examples of recursion.
In the recursion examples we will take iterative functions and convert them to recursive functions to help us understand how to write a recursive function. Having the iterative function to start with will make it easier to connect how the recursive function works. I will also go through the entire call stack of the recursive function to make understanding the inner workings of recursion easier. By the end of this video you will have an in depth understanding of recursion and be able to use it in your own projects.
Materials/References:
CodePen Code: https://codepen.io/WebDevSimplified/pen/JqQEeM
Recursion Article: https://blog.webdevsimplified.com/2021-04/recursion
🧠Concepts Covered:
- What recursion is
- Why recursion is important
- How to convert iterative functions to recursive function
- How to avoid infinite recursive loops
- When recursive functions are better
Find Me Here:
Twitter: https://twitter.com/DevSimplified
Discord: https://discord.gg/7StTjnR
GitHub: https://github.com/WebDevSimplified
CodePen: https://codepen.io/WebDevSimplified
#Recursion #Recursive #JavaScript