In this context, at the moment that there is an error in the code it does not have because it keeps running, everything else is compromised. It may be that some cases are not, but it is difficult to assess this, if it was wrong is always treated as impossible to continue, even if you can do it properly. In theory I could create a way to evaluate this and continue, but it gives a monumental work, slows down and does not bring practical advantages. Fix the mistake and be happy.
As noted above there is context that the execution does not stop, but the error still exists. It is Javascript being Javascript (inconsistency). I did tests in various situations (within the scope as per the comment) and in all the code stops running, hugocls showed a case that can be considered corner case who agrees to continue. Unless someone presents a rationale of the committee, or something in the specification saying that they wanted this, I consider that it is either error in specification or implementation (very common even because JS have one of the worst specifications ever created giving room for much interpretation of the implementer - curiously in contrast to C that lets the implementer have a lot of flexibility without being vague or ambiguous)even indicates this because it does not make much sense not only to continue, but to continue in such a specific case.
Test this for you to see
window.onload = function() {
 document.body.style.background = 'red';
 console.log(a);
};

console.log('still going...');
Puts error within a scope...– hugocsl
So it’s not a rule that some code error stops working the rest @hugocsl.? mainly on
Javascript
.– novic
@Virgilionovic depends on the situation, I gave the example only didactically, if the error is within one function it does not interfere in another. The way AP asked is very generic... Within a single scope everything that comes below the error usually does not perform. Without a real situation it’s hard to say what, so I left it as a comment. The fact that the error occurs in an insolated place within a function may not disturb the rest of the code, depending on the case logically... And I don’t even know about JS, but I’ve seen a lot of code with "working" rss error
– hugocsl
@hugocsl this, I also agree with what you did, it is not always, it is not rule, mainly in the box of surprise
Javascript
. His question really is that it stops working, but perhaps (as the staff does not ask a better question that encompasses more scenarios) is his example a good omen in saying that everything depends. Important what you did.– novic
@hugocsl, that was it, it worked! without having to stop all the code because of an error, please be as you add a reply with more details?
– user173282
@hugocsl, this means that if the error is within the scope of the function
a()
, this same error will not affect the functionb()
that is out of functiona()
???– user173282
Draw the JS is not my specialty, I prefer to let someone with more experience answer to you, that if it appears here someone willing... Maybe if you ask a more objective question and with your real problem, with the real code of the problem, someone can help you more closely to your case... An error in the a() function will not necessarily block b(), but you have to expose your actual situation with your current code
– hugocsl
Okay, but thank you so much for answering, it opened up another way for me to snoop.
– user173282