What is JS Call Stack
There are the following points where the call stack is being used by the JS engine:
How the code works
In the above code, we have created two functions, getSum () and findavg (), and the execution of the script begins in the following described steps:
When does call stack overflow
The below example describes the stack overflow condition:
So, in the above code, we can see that we have invoked the test () function recursively, which means this function will execute until the host environment maximum call size exceeded, and thus the stack throws the stack overflow error.
Point to be noted: