What is wrong in this code, trying to return an array start at startNum and ends at endNum, recursively

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function rangeOfNumbers(startNum, endNum) {
 return [startNum];
let arr = rangeOfNumbers(startNum, endNum-1);
arr = arr.push(endNum);
return arr;

  **Your browser information:**

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

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:

I would look into what the Array.push method returns

You are assigning the function for the array to your variable. It is not needed.

Assigning the return value of the recursive call to rangeOfNumbers() to a variable is definitely needed.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.