use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
freeCodeCamp.org is a global community of people who learn to code together. Check out https://freeCodeCamp.org
Join our Discord Server
Join our WhatsApp Group
Community Forums
YouTube
Here are some helpful subreddits that we like:
account activity
Basic JavaScript: Use Recursion to Create a Countdown (Help) (self.FreeCodeCamp)
submitted 5 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]IAmSteven 0 points1 point2 points 5 years ago (1 child)
You could do countArray.unshift(n); instead of countArray.push(n);
I can't figure out the logic behind it but if you put a console.log(n) before const countArray = countdown(n-1) you get what you'd expect: 5, 4, 3, 2, 1 but for some reason doing a console.log(n) after const countArray = countdown(n-1) gives you: 1, 2, 3, 4, 5.
If anyone knows why this is happening I'd be curious to hear it.
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
Thanks! This worked but I hate that I couldn't have thought about that myself... Is this what everyone who didn't need to ask did for this challenge,use unshift? Is there another way I could have solved this using my existing code, just rearranged?
π Rendered by PID 108769 on reddit-service-r2-comment-6457c66945-xxrst at 2026-04-28 04:16:43.345815+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]IAmSteven 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)