Citation :
2.4 Optional Semicolons
Simple statements in JavaScript are generally followed by semicolons (;), just as they are in C, C++, and Java. The semicolon serves to separate statements from each other. In JavaScript, however, you may omit the semicolon if each of your statements is placed on a separate line. For example, the following code could be written without semicolons:
But when formatted as follows, the first semicolon is required:
Omitting semicolons is not a good programming practice; you should get in the habit of using them.
|