Introduction

Some problems are more naturally solved using recursion. For example, a sequence like the Fibonacci sequence has a recursive definition. Each number in the sequence is the sum of the previous two numbers in the sequence. Problems that require you to build or traverse a tree-like data structure can also be solved with recursion. Training yourself to think recursively will give you a powerful skill to attack such problems.

In this tutorial, I will go through several recursive functions step by step to see how they work and show you techniques you can use to systematically define recursive functions.

Contents:

  • What Is Recursion?
  • Recursion With Numbers
  • Recursion With Lists
  • Building Lists
  • Review

#javascript #web-development #developer

Understanding Recursion With JavaScript
2.55 GEEK