Stack overflow is a situation or condition that occurs due to bad recursion in javascript.
A stack overflow occurs when there is a recursive function (a function that calls itself) without an exit point. The browser (hosting environment) has a maximum stack call that it can accomodate before throwing a stack error.
To understand stack overflow, its very important to understand about Call Stack.
A call stack is a mechanism for an interpreter (like the JavaScript interpreter in a web browser) to keep track of its place in a script that calls multiple functions — what function is currently being run and what functions are called from within that function, etc.
1) When a script calls a function, the interpreter adds it to the call stack and then starts carrying out the function.
2) Any functions that are called by that function are added to the call stack further up, and run where their calls are reached.
3) When the current function is finished, the interpreter takes it off the stack and resumes execution where it left off in the last code listing.
4 ) If the stack takes up more space than it had assigned to it, it results in a "stack overflow" error.
Support my channel by liking and sharing my videos so that I can reach to wider audience. Please share it in your network 🙏
Connect with me on social platform:
Facebook: / angularjs4beginners
LinkedIn: / nisha-singla-82407aa0
Instagram : / passion4code
Twitter: / nishasingla05
For more such interesting videos, please subscribe to my channel and stay connected.
#StackOverflow #NishaSingla #CallStack
In questa pagina del sito puoi guardare il video online Stack Overflow in Javascript| Call Stack| Interview Question della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Nisha Singla 13 dicembre 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,950 volte e gli è piaciuto 66 spettatori. Buona visione!