Hello everyone , i have a question
First this is the code
function rangeOfNumbers(startNum, endNum) {
if (endNum < startNum) {
return [];
} else {
const countArray = rangeOfNumbers(startNum, endNum - 1);
countArray.push(endNum);
return countArray;
}
Why (endNum - 1) what does it mean? I def know endNum, yet why subtracting 1 from endNum??
**Challenge:** Basic JavaScript - Use Recursion to Create a Range of Numbers
**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers