Close but no cigar

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

  **Your code so far**

// Only change code below this line
function countdown(n){
if (n<1){
  return "";
else {
  return n+countdown(n-1)

// 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/92.0.4515.131 Safari/537.36

Challenge: Use Recursion to Create a Countdown

Link to the challenge:

so i get 54321 but not 5,4,3,2,1. im drawing a blank as to how to make it a array.

You’re telling it to return a string, so it’s returning a string

Also review the lessons on how to add values to arrays, what you’re trying to do is literally add, as in 1 + 1 (or for strings, concatenate, "hello " + “world”)

1 Like

thanks for sending me in the right direction. im going to spend some time reviewing push pop shift and unshift.

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