W3Resource
w3resource.com › javascript-exercises › javascript-recursion-functions-exercises.php
JavaScript Recursion - Exercises, Practice, Solution - w3resource
March 5, 2025 - This resource offers a total of 65 JavaScript Recursion problems for practice.
javascript - recursion practice : rewriting DOM methods - Stack Overflow
I am doing a practice for recursive function and trying to write DOM methods like getElementsByClassName. I understand that recursion consists of base case and recursive case but not sure how to More on stackoverflow.com
Does anyone actually use recursion?
To all following commenters: please, do not bring up the old circlejerk jokes/memes about recursion ("Understanding recursion...", "This is recursion...", etc.). We've all heard them n+2 too many times. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
[Best Practices] Recursion. Why is it generally avoided and when is it acceptable?
I know it can be frustrating, but like most design decisions there is no hard rule. Recursion should be used when it makes sense to do so, and avoided when it does not. Any experienced programmer will recognize a recursive design immediately, and have enough experience to understand/debug it. As a beginner I can only recommend that you experiment with both solutions until you get a feel for when one is better than the other. More on reddit.com
When to use recursion?
Anything that can be done with recursion can be done with a loop. Some problems are much much easier to solve with recursion , example: most tree algorithms and graph algorithms. Recursion can easily solve a problem but can be really really bad in terms of memory use for example Fibonacci numbers. But there are things like caches you can use to improve these problems so it is a trade off sometimes. More on reddit.com
JavaScript Recursion Tutorial - Solve Recursion Problems - Dry ...
01:19:19
Exercises: Recursion - Javascript In Depth - YouTube
#50 JS Recursion made EASY | JavaScript Full Tutorial
19:02
JavaScript Recursion Examples | Javascript Recursion Tutorial - ...
01:07:58
Recursion - Javascript In Depth - YouTube
22:21
JavaScript Recursion is Made Easy to Understand - YouTube
Reddit
reddit.com › r/learnprogramming › having a tricky time understanding recursion in javascript
r/learnprogramming on Reddit: Having a tricky time understanding recursion in Javascript
June 9, 2022 -
I learned basic recursion the other day, but I'm still having a bit of tricky time understanding it. Like I can mostly understand how it works, but what would be a real world use for it?
Like for example in webdev. Can someone point me to a resource to explain it like I'm 5 years old?
Top answer 1 of 5
5
For webdev, the only real-world example I can give is for a CRM, we had locations in a building we needed to track, and each location could have sub-locations, and those sublocations could have sub-sub-locations. One day, we had to implement a system that if someone booked a parent location, the child locations would also be booked, and if someone booked a child location, the parent locations would become unavailable (if someone books half a gymnasium, another group obviously can't book the full gymnasium at the same time). The algorithm I ended up using was a recursive graph search. From a parent, check if any children were booked. Then move to the children and check if any of those parents were booked, then move to those children and check if any of its children were booked... Recursion is used when you encounter smaller versions of the original problem while trying to solve the original problem. That's the case when searching through a tree, where the problem at each layer is nearly identical regardless of what layer you're looking at.
2 of 5
3
Generally, you use recursion only when the recursive version of the problem is easier more intuitive to understand. Fibonacci is one of the easiest problems to understand recursion with despite the horrible inefficiency of the recursive version of that algorithm compared to just looping... A real world example I have seen in iOS programming is a case where I want to debug some views, so I want to log out information about a view and all of its subviews (and all of their subviews, etc.). So that might look something like this... func debugInfo() -> String { var debugInfo = "someInfoAboutThisView" for subview in subviews { debugInfo += "\n\(subview.debugInfo())" } } Now I'll have a debug string with information about this view and all its descendent views down the view hierarchy.
Any good way to understand recursion problems? My brain keeps refusing! Oct 26, 2025
r/learnprogramming 9mo ago
In which scenario is it better to use recursion rather than iteration? Nov 26, 2023
r/learnprogramming 2y ago
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-understand-recursion-in-javascript
Recursion in JavaScript - GeeksforGeeks
Recursion is a technique where a function calls itself to solve a problem by breaking it into smaller, similar subproblems until a base condition is met.
Published January 16, 2026
CodeSignal
codesignal.com › learn › courses › sorting-and-searching-algorithms-in-js › lessons › exploring-the-magic-of-recursion-in-javascript
Exploring the Magic of Recursion in JavaScript
We dove into the sea of recursion, familiarized ourselves with vital concepts like base and recursive cases, and implemented a simple JavaScript recursive function. We'll deepen our understanding of recursion with continuous practice and be well-prepared for succeeding lessons involving complex ...
The Odin Project
theodinproject.com › lessons › javascript-recursive-methods
Recursive Methods | The Odin Project
Go to the computer_science/recursion/ directory of The Odin Project’s JavaScript exercises repo and complete each of the exercises in order. Be sure to review the README for each exercise prior to completing it.
Codesmith Enterprise
codesmith.io › blog › introduction-to-recursion-in-javascript
Codesmith | Introduction to Recursion in JavaScript
Like most things in JavaScript, there are several ways to achieve this goal. Above, the base case is slightly different: if(num <= 0) return. This is a bit safer as it accounts for the possibility of a num having a negative value. You might also notice how, instead of decrementing num and then invoking sayHi with the new value, we’ve passed num - 1 as the argument itself to the recursive sayHi call.
Medium
medium.com › @nonyeibeanu › solutions-to-some-challenging-recursion-problems-in-javascript-485743c3c5ad
Solutions to some Challenging Recursion Problems in JavaScript | by Nonye Ibeanu | Medium
April 11, 2023 - // result is initialized to 0 by default. function nestedEvenSum(obj, result = 0) { // base case if the object is empty if(Object.keys(obj).length === 0) return result; // iterating through each key in the obj parameter for (const key in obj) { /* If the value of the current key in obj is an object, the function calls itself recursively, passing in the object as the new obj parameter.
Codecademy
codecademy.com › docs › javascript › recursion
JavaScript | Recursion | Codecademy
November 16, 2025 - This process is similar to how loops work, but recursion uses function calls instead of loop structures. In this example, the function repeatedly calls itself to print numbers from 1 to 10, stopping once the base case condition (count < 10) is no longer true: ... Front-end engineers work closely with designers to make websites beautiful, functional, and fast. ... Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
Playcode
playcode.io › javascript › recursion
JavaScript Recursion: Complete Guide with Examples | Playcode
Master JavaScript recursion: understand base cases, recursive calls, and practical examples like factorial, Fibonacci, and tree traversal. Learn when to use recursion vs iteration.