Recursion
A function calling itself to solve a smaller piece of the same problem.
What is Recursion in JavaScript?
Recursion — A function calling itself to solve a smaller piece of the same problem.
function countdown(number) {
if (number === 0) {
return 0;
}
return 1 + countdown(number - 1);
}
Level: Journeyman · More JavaScript terms at this level
Updated