Stack Overflow in Javascript| Call Stack| Interview Question

Veröffentlicht am: 13 Dezember 2021
auf dem Kanal: Nisha Singla
1,950
66

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


Auf dieser Seite können Sie das Online-Video Stack Overflow in Javascript| Call Stack| Interview Question mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Nisha Singla 13 Dezember 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,950 Mal angesehen und es wurde von 66 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!