Recursion is a concept where a function calls itself and keeps calling itself until it is told to stop. In loops, when the condition for execution forever remains true, you get an infinite loop which can crash your application. Recursion works similarly to how loops do in JavaScript. To avoid this infinite recursion that maxes out the call stack, we need a condition that stops the recursion.
Table of contents
What is Recursion?What is the Call Stack?Recursion and the Call StackGeneral Case and Base Case in RecursionWrapping upSort: