Is It Possible to Stop Javascript Execution? [Duplicate]
Is It Possible in Some Way to Stop or Terminate Javascript in a Way That It Prevents Any Further Javascript-Based Execution from Occuring, Without Reloading...
Is it possible in some way to stop or terminate JavaScript in a way that it prevents any further JavaScript-based execution from occuring, without reloading the browser?
I am thinking of a JavaScript equivalent of exit() in PHP.
11 Answers
Short answer:
throw new Error("Something went badly wrong!");
If you want to know more, keep reading.
Do you want to stop JavaScript's execution for developing/debugging?
The expression debugger; in your code, will halt the page execution, and then your browser's developer tools will allow you to review the state of your page at the moment it was frozen.