Correct result not coming

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

// Only change code below this line
function countdown(n){
  return myArray
// Only change code above this line
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Challenge: Use Recursion to Create a Countdown

Link to the challenge:

myArray is never declared. You may find this useful:

Alternatively you do not need an array as a parameter, and instead you can have your recursive function return an array that contains n as well as the recursive call to the function.

The second method requires that you spread the value of the recursive call as it returns an array, and you may need to rework your base case if you go this rout. It sounds a bit confusing, but personally I think it’s easier to understand when actually written in code compared to the first method.

You can use either of these for combining the arrays:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.