Tell us what’s happening:
How do i get this countdown to display on the console
Your code so far
// Only change code below this line
//COUNTDOWN
function countdown(n) {
if (n < 1) {
return [];
} else {
const arr = countdown(n - 1);
arr.unshift(n);
return arr;
}
}
console.log()
// Only change code above this line
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0
Challenge: Basic JavaScript - Use Recursion to Create a Countdown
Link to the challenge: