4 ms·
That's not how it works, semicolons are only automatically inserted if they were omitted. Use semicolons, lint the code, ????, profit
by cerved 9y ago
That's not how it works, semicolons are only automatically inserted if they were omitted.
Use semicolons, lint the code, ????, profit
- z3t4 9y agoI just tried to get the linter (JShint) to break some valid code, but it didn't. So you can actually rely on the linter to insert the semicolons for you. It would be interesting to find out if there are any cases where the linter will insert the semicolon in the wrong place.
- tedunangst 9y agoThe browser somehow detects that the missing semicolon wasn't omitted and doesn't add it???
- cerved 9y agoNo. If it's missing it's inserted obviously. That's why you shouldn't omit it. Here are the rules for parsing if you're interested When the program contains a token that is not allowed by the formal grammar, then a semicolon is inserted if (a) there is a line break at that point, or (b) the unexpected token was a closing brace. When the end of a file is reached, if the program cannot be parsed otherwise, then a semicolon is inserted. When a "restricted production" is encountered and contains a line terminator in a place where the grammar contains the annotation "[no LineTerminator here]", then a semicolon is inserted.