재귀함수에서 중요한점은 죵료 시점을 넣어야 한다는 것.
동작은 Call Stack으로 이루어진다.
다음 방식으로 입력한 배열 중 홀수를 골라내는 재귀함수를 만들어 보았다.
function helperMethodRecursion(helperInput){ const result = []; function recursion(helperInput){ if(helperInput.length === 0) return; if(helperInput[0] % 2 !== 0){ result.push(helperInput[0]); } helper(helperInput.slice(1)); helper(helperInput); return result; }