Dont know why thuis code note working

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

  **Your code so far**

function rangeOfNumbers(startNum, endNum) {


if ( endNum - startNum === 0)
{
  return [stratNum];

}else
{


var numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;

}
}
  **Your browser information:**

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

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:

Hi @roshanmuhmdnavas !

Welcome to the forum!

Two things.

No.1:
It helps to format your code so you can find errors better.

function rangeOfNumbers(startNum, endNum) {


  if (endNum - startNum === 0) {
    return [stratNum];

  } else {
    var numbers = rangeOfNumbers(startNum, endNum - 1);
    numbers.push(endNum);
    return numbers;

  }
}

No2:
Spelling error here

Hope that helps!

1 Like

@jwilkins.oboe

Thanks, it did help.

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