This is not "WHY", this is "HOW exactly". I bet the reason why JavaScript has these behaviors is due it being developed as a browser scripting language. Authors didn't want the entire script terminating because some part of it was buggy. This could have been handled by some clever isolation and error-recovery mechanism, but it wasn't. Probably due to time constraints.
These kinds of things are one of the reasons why I really don't like the idea of everything (including server-side and standalone apps) being written in JavaScript.
It's a language that is heavily used for server apps, which the top post was saying JS shouldn't do. My point was, quirks like these haven't outweighed the advantages of PHP, and I don't think they should for JS either.
These kinds of things are one of the reasons why I really don't like the idea of everything (including server-side and standalone apps) being written in JavaScript.