Write a Recursive Function in JavaScript
lessonDuration 3m 3sFree
A recursive function - a function that calls itself - is a key tool in every functional programmer's toolbox. The body of a recursive function needs two main parts: - a recursive case, in which the recursive call is made, and - a base case, which does not involve recursion and prevents the function from recursing infinitely. In this lesson we'll learn the anatomy of a recursive function by writing a function to compute the [factorial](https://en.wikipedia.org/wiki/Factorial) of a positive integer.