Basic JavaScript - Use Recursion to Create a Range of Numbers

Tell us what’s happening:
Hi all, this is my first request for help, and any assistance would be greatly appreciated!

Basically I’ve written the code below, which seems to give me correct outputs when I run them on JSConsole – but when I it in the challenge it fails the tests. Can anyone see where I’m going wrong? Thanks very much!

Your code so far

function rangeOfNumbers(startNum, endNum) {
  let arr1 = [];
  if (startNum > endNum) {
    return arr1;
  } else {
    arr1.push(startNum);
    arr2 = arr1.concat(rangeOfNumbers(startNum+1, endNum));
  }
  return arr2;
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Use Recursion to Create a Range of Numbers

Link to the challenge:

What is this line doing? This is your problem line.

Adding this line

console.log(rangeOfNumbers(1, 5));

will help you see why.