Please review this code with me

Tell us what’s happening:
Hey y’all I know this is incorrect but I am not sure why its not working. I tried to mimic the previous lesson and wanted to know how to make it work. I know there are easier ways but I wanted it do it this way. I am open for it to just be straight up wrong but I am looking more for an explanation why it does or does not work this way. Thanks!

Your code so far

function rangeOfNumbers(startNum, endNum) {
if (startNum <= endNum) {
  return [];
} else {
 const array = countup(endNum - 1 === startNum);
 return array;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:


The main problem is that your function is being called once, and the return is an empty array:

rangeOfNumbers(5, 10);

// Inside the function:
startNum = 5
endNum = 10

// Check the if:
// is 5 less or equal to 10? Yes, then enter the if
return []

// Nothing else gets executed.

Besides that, the function countup doesn’t exist on JavaScript (unless you create it yourself or use a library). Check what your code does here on python tutor.