Recursive functions are not infinite - they can continue only until the stack space ends.
'Stack space' in this context is the memory that the program (i.e. the browser) allocates to remember the chain of function calls, so when your functions return, it knows where to return.
This memory space is limited, and when it ends, the program will stop and give an error (error).
If you are using a browser that has a developer tool window (i.e., almost all major browsers), you should see that the error is displayed in the console window when this happens.
The exact number of times the browser will run your loop depends on the browser and how much memory it has allocated for the stack. It is not that you have direct control - of course, not in the context of the browser; in lower-level programming, such as a C / C ++ program, you will have tools to determine the size of the stack yourself, but in the browser these things are uncontrollable. However, the browser should allocate enough memory for the stack so that the program will never hit it unless it falls into an infinite loop.
source share