My code runs perfectly on local server with VScode but the freecodecamp engine dose not accept it

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

  **Your code so far**

function rangeOfNumbers(startNum, endNum) {
let k=endNum-startNum;
  countArray=rangeOfNumbers ( startNum, endNum-1);
  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
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

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