Tell us what’s happening:
Describe your issue in detail here.
Could anyone explain why my code is not validating as correct, whereas if I run it locally in VsCode, it gives the correct results which are in the descending order. I have not used any global variables also and have used recursion as was mentioned in the challenge.
Your code so far
// Only change code below this line
function countdown(n){
if (typeof countArray==='undefined'){countArray=[];}
if (n<1){return countArray;}
countArray.push(n);
countArray=countdown(n-1);
return countArray;
}
// Only change code above this line
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Use Recursion to Create a Countdown
Link to the challenge: