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