function rangeOfNumbers(startNum, endNum) {
if (endNum - startNum === 0) {
return [startNum];
} else {
var numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;
}
}
I need help understanding how this solution works with recursion.
Sky020
2
Welcome, codeLive.
This topic of understanding recursion is a common one. Here are recent posts about the same question:
I hope this helps
1 Like