Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function rangeOfNumbers(startNum, endNum) {
countArray=[];
let k=endNum-startNum;
if(k>=0){
countArray=rangeOfNumbers ( startNum, endNum-1);
countArray.push(endNum);
}
return countArray;
};
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Challenge: Use Recursion to Create a Range of Numbers
Link to the challenge:
Looks like the compiler would like you to declare countArray
using var
, let
, or const
. in other languages like golang and python declaring the variable without these keywords is permitted, but in Javascript it’s not considered a best practice (though technically possible).
1 Like
The challenges run in Strict mode .
Not sure how you are running the code in VS Code but if you add 'use strict'
to the top of the file (or function) you should get an error as well.
1 Like
system
closed
February 6, 2022, 7:45pm
#5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.