Please Explain this code in detail

Tell us what’s happening:
Describe your issue in detail here.
Please explain this code in detail.

  **Your code so far**

// Only change code below this line
function countdown(n){
if(i>1){
  return []
}
else{
  const countArray = countdown(n-1);
  countArray.push(n);
  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/98.0.4758.102 Safari/537.36

Challenge: Use Recursion to Create a Countdown

Link to the challenge:

This exact problem has been explained in detail in several posts on the forum. Is there a specific part of those explanations that didn’t make sense to you? If you can focus our efforts, we can provide a better explanation tailored to you.

The first thing I would explain is that the code you pasted doesn’t solve the challenge. The very first line in the function body has a reference error. Do you see it?

1 Like

yes, I can see. here the condition is (n)