Tell us what’s happening:
Please can someone explain why this code doesn’t display an array?
**Your code so far**
function rangeOfNumbers(startNum, endNum) {
if (startNum === endNum) {
return startNum;
}else if (startNum > endNum){
return [];
} else {
const countArray = rangeOfNumbers(startNum - 1);
countArray.push(endNum);
return countArray;
}
};
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36
.
Challenge: Use Recursion to Create a Range of Numbers
Link to the challenge: