Wednesday, June 15, 2005

Too much recursion

Press this to see how even the high-level scripting languages in the mainstream prevent programmers from using recursion.

Different Javascript engines will give you different error messages, but the Mozilla one is the most offensive: "too much recursion." Groan.

Update: I've modified the Javascript so it should work in Safari, too. But I'm not going to spend more time making a broken script work in multiple browsers.

11 comments:

Anonymous said...

> Different Javascript engines will
> give you different error messages,
> but the Mozilla one is the most
> offensive: "too much recursion."

In my application, IE 6 had the worst behavior. It just crashed. Using Firefox I got the "Too much recursion" message, which then led me to this page, and then it took me a few seconds to figure out where I had an infinite recursion problem.

Interestingly enough, IE 6 does not crash with your example.

Anonymous said...

FWIW in Firefox 3.5.5 on a win2k box the limit appears to be 3000 calls.

Too bad finding documentation of that is nontrivial.

That said, expecting javascript to support an infinitely large stack is a bit silly -- if you know you are doing deep recursion you should be creating your own custom "stack".

http://www.htmlgoodies.com/primers/jsp/article.php/3622321

is a useful guide.

Dave Herman said...

That said, expecting javascript to support an infinitely large stack is a bit silly -- if you know you are doing deep recursion you should be creating your own custom "stack".

Absolutely not.

bumbu pecel bali said...

this is good post.
and you can go here

http://bantalsilikon01.blogspot.com
http://kursusinternetmarketingmurah.blogspot.com
http://bumbupecelbali.blogspot.com


tanks very much.... :)

Radley Co Tad said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

Term Paper Writing Services said...

Legitimate Custom Nursing Writing Service company is well known in USA for completing the Best Nursing Writing Services and Nursing Research Paper Services.

timmykeels said...


Hello very cool site!! Man .. Excellent .. Superb .. I’ll bookmark your blog and take the feeds additionally¡KI am glad to search out so many helpful info right here within the post, we want develop extra strategies in this regard, thank you for sharing. . . . . .
Do check
Paypal Login
gemini login

timmykeels said...


Hello my family member! I want to say that this article is awesome, great written and include almost all important infos. I’d like to see more posts like this .
Do check
Paypal Login
gemini login

jack peterson said...

Thanks for giving such wonderful informative information.
Do check
Telstra email login

Unknown said...


Thanks for giving such wonderful informative information.
Do check
Paypal Login
gemini login

Anonymous said...

For activating YoutubeTV you need to go on 'tv.youtube.com/start', 'tv youtube com start', 'tv.youtube.comstart' or any other YouTubeTV related issues please do visit webite -
tv.youtube.com/start