Why does this code not work

Why does this code not work

// Only change code below this line

function countdown(n){
 return [];
} else{
 const countArray = countdown(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/85.0.4183.102 Safari/537.36.

Challenge: Use Recursion to Create a Countdown

Link to the challenge:

i figured it out i typed shift instead of unshift

1 Like

@Self1sh nice one,

What does the shift function do? That is where the problem is.

You might want to try unshift. I highly recommend you to re-learn those array functions.

stay blessed

i thout shift did what unshift does i got them mixed up

1 Like

A lot of people struggle to remember which of the methods does what. Not the greatest named methods JS has if you ask me.