In the context of Computer Science recursion refers to a function that calls itself in order to arrive at a return value.
In order to avoid infinite recursion (infinite loop) a base case is established which does not have a recursive call. This
solution is typically employed in Divide and Conquer
algorithms or where recursion is more elegant than a loop. A common
example is calculating a number's factorial. Here is an example written in es6
.
const factorial = number => number === 1 ? 1 : number * factorial(number - 1);