Tell us what’s happening: I’m getting an error that my result is not an array. Using online javascript interpreters and console.log I’m seeing the correct arrays as output, but freecodecamp isn’t accepting my code for some reason because “Your function should return an array.”.
function rangeOfNumbers(startNum, endNum) {
if (startNum == endNum) {
return [endNum];
} else if (startNum < endNum) {
result = rangeOfNumbers (startNum, endNum - 1);
result.push(endNum);
return result;
}
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.152 Safari/537.36.
Challenge: Use Recursion to Create a Range of Numbers