JavaScript’s “automatic semicolon insertion” rule
I had no idea about the below found at [1],
very interesting, I'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.
Ask HN: Is there any other language that does the same?
[1] Quote from http://www.craftinginterpreters.com/scanning.html :
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.