Recursion range of numbers1

Tell us what’s happening:
cant figure the right code

Your code so far
function rangeOfNumbers(startNum, endNum) {
if (startNum === endNum) {
return [startNum] ;
}else{
constarr= rangeofNumbers(startNum,endNum -1);
arr.push(endNum);
return arr;
}
};


function rangeOfNumbers(startNum, endNum) {
if (startNum === endNum) {
return [startNum] ;
}else{
constarr= rangeofNumbers(startNum,endNum -1);
arr.push(endNum);
return arr;
}
};

Your browser information:

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

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:

I have added a function call in the editor (it is always a good idea to monitor the execution of the code), and there is an error appearing:

image

try doing it yourself, and solve the error(s) that appear

Tell us what’s happening:

solution not working is there a bug in software

Your code so far
function rangeOfNumbers(startNum, endNum) {
if (startNum == endNum) {
return [startNum] ;
} else {
var numbers= rangeofNumbers(startNum,endNum -1);
numbers.push(endNum);
return numbers;
}
};


function rangeOfNumbers(startNum, endNum) {
if (startNum == endNum) {
return [startNum] ;
} else {
var numbers= rangeofNumbers(startNum,endNum -1);
numbers.push(endNum);
return numbers;
}
};

Your browser information:

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

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:

The bug is in your code.

var numbers= rangeofNumbers(startNum,endNum -1);

There is a typo in this line.

1 Like

So what’s the solution please I’ve been trying for a week

We still do not give out solutions on the forum, but we will work with you to fix the errors in your code.

Have you fixed the typo in the line above? What is your updated code?

can you say what you did not understand of my post the other day? I hope I can clarify better

Yes what should I fix

look at the error, do you understand why it appears?

The typo. You’ve made a spelling mistake.

No could you explain comprehensive ly

Hi @jmnqv123!

FCC instructions
We have defined a function named rangeOfNumbers

Now look at your code

The typo that everyone is talking about has to deal with one letter.
Exam the correct function name very carefully and compare it with yours.
Once you find the letter that is wrong, fix it and the test will pass.

thanks a lot greatly appreciate