Tell us what’s happening:
Ended up having to look at the hints for this challenge. Can some one explain what is happening in this solution. Specifically what is happening here.
var numbers = rangeOfNumbers(startNum, endNum - 1);
What exactly is happening to startNum and endNum This is really confusing.
**Your code so far**
function rangeOfNumbers(startNum, endNum) {
if (endNum - startNum === 0) {
return [startNum];
} else {
var numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;
}
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Challenge: Use Recursion to Create a Range of Numbers
Link to the challenge: