I have been quite curious about how javascript reacts to errors(like ReferenceError, for example). When it encounters a runtime error, it seems to return from the function that it is called in which, in turn, fails the function it was called in.
Does it consequently fail all the functions in the frame stack?
(This is more of a question out of academic curiosity. Hope somebody can explain it to me?)
Thanks!
JavaScript exception handling is much the same as other languages’ error handling – it will
throwan error up the call stack until handled by thecatchof atryblock. If there is no try/catch, then the current execution will stop.All the function calls below the
catchwill be exited – they won’t return anything, and the following lines of code will not be executed.