unread
why not to make semicolon not required if there is only 1 statement like
javascript.
semicolon will be required if there are multiple statements on the same
line.
unread
why not to make semicolon not required if there is only 1 statement
like javascript. semicolon will be required if there are multiple
statements on the same line.
Because this "feature" of JavaScript leads to confusing code and unintended bugs
(see examples at https://codeburst.io/why-i-prefer-to-use-semicolon-in-javascript-f00c303547).
Many JS projects end up relying on a linter to require semicolons and avoid these issues.
The fact that PHP requires semicolons is one of the things I like about the language.
Best regards,
Theodore Brown