Content deleted Content added
m Dead links |
|||
Line 40:
|year=2006}}</ref>
There are two issues: five tokens can either begin a statement or be the extension of a complete statement; and five restricted productions, where line breaks are not allowed in certain positions, potentially yielding incorrect parsing.
The five problematic tokens are the open parenthesis "<code>(</code>", open bracket "<code>[</code>", slash "<code>/</code>", plus "<code>+</code>", and minus "<code>-</code>". Of these, the open parenthesis is common in the [[immediately-invoked function expression]] pattern, and open bracket occurs sometimes, while others are quite rare.
<syntaxhighlight lang="javascript">
Line 53:
with the suggestion that the preceding statement be terminated with a semicolon.
Some suggest instead the use of ''leading'' semicolons on lines starting with '<code>(</code>' or '<code><nowiki>[</nowiki></code>', so the line is not accidentally joined with the previous one. This is known as a '''defensive semicolon''', and is particularly recommended, because code may otherwise become ambiguous when it is rearranged.
<syntaxhighlight lang="javascript">
|