Build a Countdown - Build a Countdown

Tell us what’s happening:

Hi community. All tests are passing, except the one that asks me to use recursion to solve the problem. From my understanding, recursion is being used, right? Is the lab bugged or does it expect another solution?

Your code so far

const countdown = n => {
    let countArray = [];
    if(n < 1){
        return [];
    } else{
        countArray = countdown(n-1)
        countArray.unshift(n);
        return countArray;
    }
}
console.log(countdown(4));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36

Challenge Information:

Build a Countdown - Build a Countdown

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-countdown/5cd9a70215d3c4e65518328f.md at main · freeCodeCamp/freeCodeCamp · GitHub

looks like a bug. They want you to use a function declaration instead of an arrow function. So it should pass when you switch it.

I’ll open a github issue for it