


Since the call stack is single, function(s) execution, is done, one at a time, from top to bottom. It is primarily used for function invocation (call). The call stack is made up of stack frames - one for each method call. The Call Stack is what a program uses to keep track of method calls. Moreover, you can managed to find the point that was causing the error by check the error details in the Chrome dev toolbar console, this will give you the functions in the call stack, and guide you towards the recursion that's causing the error. That's when it's useful to wrap your recursive function call into a -Īlso, you can localize the issue by setting a breakpoint on RangeError type of exception, and then adjust the code appropriately. That can happen if the promises in a chain don't actually perform any asynchronous execution, in which case control never really returns to the event loop, even though the code otherwise appears to be asynchronous. It's possible to cause infinite recursion in a fully promisified code, too.
#MAXIMUM CALL STACK SIZE EXCEEDED HOW TO#
How to fix Maximum call stack size exceeded errorīe considerate while calling functions, also dry run is the best practice to prevent them. So, whenever you are trying to code a recursive function then you'll need a base case that stops the function to invoke itself. When you run the above script you can see the call stack grows until it hits a maximum limit: the browser hardcoded stack size or memory exhaustion. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited. This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript to consume lots of stack.
