May 2008
Intermediate to advanced
172 pages
4h 54m
English
JavaScript uses a C-like syntax, which requires the use of semicolons to delimit statements. JavaScript attempts to make semicolons optional with a semicolon insertion mechanism. This is dangerous.
Like C, JavaScript has ++ and -- and ( operators,
which can be prefixes or suffixes. The disambiguation is done by the
semicolon.
In JavaScript, a linefeed can be whitespace, or it can act as a semicolon. This replaces one ambiguity with another.
JSLint expects that every statement be followed by ; except for for, function, if,
switch, try, and while. JSLint does not
expect to see unnecessary semicolons or the empty statement.