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

6m read timeFrom freecodecamp.org
Post cover image
Table of contents
What is Recursion?What is the Call Stack?Recursion and the Call StackGeneral Case and Base Case in RecursionWrapping up

Sort: