As someone used to C++ and new to JavaScript, I find this behavior odd. Whether a program runs directly on the platform like C++ ones, or it runs at a higher (or deeper?) level like JavaScript ones, conceptually, a program a program and an exception is an exception. Then why does JavaScript have this behavior? Is JavaScript's definition of exception different?
Look at this simple example.
<!doctype html>
<html>
<body>
<button id="throw">Throw Exception</button>
</body>
<script>
document.getElementById("throw").onclick = function(){
throw "Uncaught Exception";
}
</script>
</html>
When the button is clicked, the console displays "uncaught exception: Uncaught Exception" as expected. However, clicking the button again even after this, an exception is thrown, meaning the script execution isn't blocked. Had it been C++, the program would have ended. The fact that it runs inside a browser shouldn't matter because the browser can simply stop the script and notify the user; after all, the browser behaves as the script's platform.
I want to know the reason behind this.
Is there a "The Design and Evolution of JavaScript" kind of book where we can understand why things are the way they are?