Range in recurssion

Tell us what’s happening:

i am not getting

Your code so far


// Only change code below this line
function countdown(n){
if (n < 1) {
return [];
} else {
const contArray = countdown(n - 1);
countArray.unshift(n);
return countArray;
}
}
console.log(countdown(5));
// 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/84.0.4147.89 Safari/537.36.

Challenge: Use Recursion to Create a Countdown

Link to the challenge:

  1. You have written const contArray… instead of const countArray!
  2. Remove console.log( countdown(5));