Recursive Functions

Learn about recursive functions in JavaScript.

We'll cover the following

What are recursive functions?

A recursive function is one that calls itself! This might sound a bit strange, but it’s perfectly possible to place a self-referential function call inside the body of the function. The function calls itself until a certain condition is met. It’s a useful tool when iterative processes are involved.

A common example is a function that calculates the factorialFactorial is a mathematical operation represented by n! that multiplies all positive integers from 1 to n. of a number:

Get hands-on with 1400+ tech skills courses.