freeCodeCamp Challenge Guide: Use Recursion to Create a Countdown

freeCodeCamp Challenge Guide: Use Recursion to Create a Countdown
0

Use Recursion to Create a Countdown


Solutions

Solution 1 (Click to Show/Hide)
function countdown(myArray, n){
  if(n <= 0){
    return;
  }
  else{
    myArray.push(n);
    countdown(myArray, n - 1);
  }
}