Recursive functions

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

I’m receiving a syntax error in the else statement, any ideas as to why???

   **Your code so far**

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

numbers.push(endNum);
return numbers;
}
}
   **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; U; Android 9; MRD-LX1F Build/HUAWEIMRD-LX1F; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 OPR/52.1.2254.54298

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:

You are missing a {. It is a bit easier to see if you format and indent your code.

I know this shouldn’t be an excuse but am using a phone and still can’t figure out the missing curly bracket

Right here. The {}s around the if clause must be balanced.

1 Like

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