Merge pull request #2612 from joaquinelio/patch-4
"not required" vs "incorrect"
This commit is contained in:
commit
bcb47b74cb
1 changed files with 1 additions and 1 deletions
|
@ -46,7 +46,7 @@ alert(3 +
|
||||||
+ 2);
|
+ 2);
|
||||||
```
|
```
|
||||||
|
|
||||||
The code outputs `6` because JavaScript does not insert semicolons here. It is intuitively obvious that if the line ends with a plus `"+"`, then it is an "incomplete expression", so the semicolon is not required. And in this case that works as intended.
|
The code outputs `6` because JavaScript does not insert semicolons here. It is intuitively obvious that if the line ends with a plus `"+"`, then it is an "incomplete expression", so a semicolon there would be incorrect. And in this case, that works as intended.
|
||||||
|
|
||||||
**But there are situations where JavaScript "fails" to assume a semicolon where it is really needed.**
|
**But there are situations where JavaScript "fails" to assume a semicolon where it is really needed.**
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue