Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exit current call stack Javascript

I'd like to exit my current call stack in javascript, in order not to explode the call stack size, but I don't have access to the setTimeout() call ie:

the function setTimeoutdon't exist in my environment :)

I still need to exit the current call stack as I reach the call stack size limit.

The environment is "parse.com" and CloudCode Modules, if any one know what's running behind, that could help as well!

Any guess?

PS: It's not because the only thing you know is a web browser environment and DOM node manipulation or even worse Javascript that you need to -1 the question, this one is really pertinent. Not every function is implemented everywhere. PS2: There's no source code attached as it's more a theoretical question than an applied question!

like image 209
flovilmart Avatar asked Dec 01 '25 15:12

flovilmart


1 Answers

Javascript supports throwing exception objects (which can be anything really), which can exit the call stack as much as you want. This MDN page might be of some use:

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/try...catch

like image 51
JayC Avatar answered Dec 04 '25 06:12

JayC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!