JavaScript’s “automatic semicolon insertion” rule
I had no idea about the below found at [1],
very interesting, I&#x27;ve always wondered why JavaScript is so much worse than other languages,
and this finally explains what they got wrong that all other languages got right.<p>Ask HN: Is there any other language that does the same?<p>[1] Quote from http:&#x2F;&#x2F;www.craftinginterpreters.com&#x2F;scanning.html :<p>JavaScript’s “automatic semicolon insertion” rule is the odd one. Where other languages assume most newlines are meaningful and only a few should be ignored in multi-line statements, JS assumes the opposite. It treats all of your newlines as meaningless whitespace unless it encounters a parse error. If it does, it goes back and tries turning the previous newline into a semicolon to get something grammatically valid.