-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Why you should use semicolons. Close #112
- Loading branch information
1 parent
81316dc
commit 7488b34
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why the "standard JavaScript" wording? It's way too similar to the JavaScript Standard Style which avoids using semicolons but explicitly says would should use semicolons when starting lines with
[
and lists other cases where it's needed. Also, says that clever short-hands, which are the main reason of having to use semicolons in this way, are discouraged.I like standard because it makes programmers think about the actual JavaScript issue: automatic semicolon insertion. Teaching "you should use semicolons" for me is just a workaround for that and which may fail if not learned properly. If someone thinks "I will just use semicolons like in other languages" then it will lead to some pitfalls like adding a line break after a
return
: works in PHP, works in C, not in JavaScript.At least improve the wording. At best, change this section to "JavaScript automatically adds semicolons, right?" and then show examples where it don't adds semicolons where it was expected and examples where it adds where it wasn't expected.