Are there any problems with recursion in jQuery
I'm using simple recursion to make a hidden div appear and disappear five times. My question is, is there any problem with using recursion with jQuery? Do I have to clear the stack or something when I'm done, and if so, how? I was looking at another post where someone got stack overflow in jQuery with only a few iterations. (Although they were doing something more complex.) It occurred to me that a simple jQuery call, especially with an Fx chain, hides a lot of stuff.
Example:
- var cnt=0;
- function repeatMe(){
- if(++cnt < 6)
- jQuery('div#glom').delay(2000).show(2000).hide(2000,repeatMe);
- }
-
- repeatMe();