Use Recursion to Create a Countdown Basic JavaScript

Tell us what’s happening:
The code is not producing expected result

Your code so far

// Only change code below this line
function countdown(n){
  if (n < 1) {
  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/87.0.4280.88 Safari/537.36.

Challenge: Use Recursion to Create a Countdown

Link to the challenge: text

what’s the result you get now?

if you call countdown(3) what is returned?

Its not showing me the result,
And actually I have failed to diagnose the problem in the code.

how are you trying to see the output?

Try putting this right before the return statement in the else block:


I think you will see what the problem is.