I’m having trouble with the final question on recursion on basic javascript.
My code is:
function rangeOfNumbers(startNum, endNum) {
if (endNum===startNum) {
return [startNum];
} else {
var num = rangeofNumbers[startNum, endNum-1];
num.push(endNum);
return num;
}
}
My error is not returning an array - i thought this would be declared by var and the basecase.
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Challenge: Use Recursion to Create a Range of Numbers
Link to the challenge: