Tell us what’s happening:
Describe your issue in detail here.
can you tell me how does .push in the example and unshift in the challlenge work? Thank you
**Your code so far**
// Only change code below this line
function countdown(n){
if (n < 1) {
return [];
} else {
const countArray = countdown(n - 1);
countArray.unshift(n);
return countArray;
}
}
// Only change code above this line
console.log(countdown(10));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
unshift is adding n at the beginning of the countArray array, which is the array returned by countdown(n-1) (which is an array containing the numbers from n-1 to 1, or an empty array)