Why do catch clauses have their own lexical environment?

Yes, catch clauses indeed have their own Lexical Environments. Check out what happens when it is evaluated: It creates a new one (deriving from the current one) and binds the exception-identifier to it. When executing the catch block, the current Execution Context’s LexicalEnvironment is switched to the new one, while the VariableEnvironment(“whose environment record holds … Read more

Automatic semicolon insertion & return statements [duplicate]

The javascript interpreter/compiler is so smart to only insert automatic semicolons if afterwards there is valid Javascript. Your code works, because && b as it stands is no valid expression – that’s why no semicolon gets inserted after the return a resulting in: return a && b && c; However: return (undefined);//implicitely inserted { …. … Read more