Tell us what’s happening:
My code runs perfectly and gives the same results as FreeCodeCamp intended tests. except that FreeCodeCamp gives back a test failure
Your code so far
// Only change code below this line
function countDown(n) {
if (n < 1) {
return [];
}
var temp = [];
temp.push(n);
temp = temp.concat(countDown(n-1));
return temp;
}
console.log(countDown(10));
// Only change code above this line
Fast Test Results
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
.
Challenge: Use Recursion to Create a Countdown
Link to the challenge: