Hey everyone,
Could someone help me identify what I did wrong in this code?
// Only change code below this line
function countdown(n){
if (n < 0){
return [];
} else {
const countArray = countdown(n);
countArray.push(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/81.0.4044.129 Safari/537.36
.
Challenge: Use Recursion to Create a Countdown
Link to the challenge: