Basic JavaScript - Use Recursion to Create a Range of Numbers | Doesn't accept working solution

I appeared to be stuck on this challenge, so I created a local web page on my computer with VS Code to more easily debug what’s happening outside of freeCodeCamp. To my surprise, it returns exactly what it should, but freeCodeCamp doesn’t accept my solution! I think it’s because it expects me to subtract 1 from endNum but adding 1 to startNum appears to be a working solution although freeCodeCamp does not accept that solution.

This is the code I wrote locally on my computer in VS Code:

function rangeOfNumbers(startNum, endNum) {
    const arr = [];
    if(startNum == endNum) {
        return arr;

    arr.push(rangeOfNumbers(startNum + 1, endNum));
    return arr;

alert(rangeOfNumbers(1, 10));

If I link this to a blank html document, it alerts the correct numbers in the correct order. But freeCodeCamp does not accept this solution! Is this a bug? Note that I do not use alert in the actual freeCodeCamp solution. Only in VS Code. I also get the correct numbers in the correct order if I change the arguments from 1 and 10 respectively.

Link to the challenge:

Won’t this make an array inside of an array inside of an array…

You need to make a flat array

I’m also not sure if alert will work in the fCC editor.

I just wrote that I don’t use alert in fCC editor, only in VS Code…
You appear to be correct that it is creating nested arrays. Alert didn’t show this, but if I use console.log I can see that’s what’s happening. Thank you for your help!

I missed the part where you said you posed code you weren’t trying to get to pass in the fCC editor - hopefully my confusion is understandable, its somewhat early here.