Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem. In the context of algorithms, this is achieved using a recursive function.
this is simply a function that calls itself.
Recursion in 4 steps:
1. Identify a base case(s)
2. Build up a recursive case(s)
3. Return output where needed
4. Get closer to base case(s).
Blog:
https://www.codeisbae.com
Twitter:
https://twitter.com/code_is_bae
Тэги:
#JavaScript #programming #algorithms #data_structures