재귀(Recursion)는 자신을 정의할 때 자기 자신을 재참조하는 방법을 뜻하며, 이를 프로그래밍에 적용한 재귀 호출(Recursive call)의 형태로 많이 사용된다.
function factorial(n) { return n * factorial(n-1) } let output = factorial(5) // factorial(5) = 5 * factorial(4) console.log(output) // 120