Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. This serves to separate them from the following statement. In JavaScript, however, you are allowed to omit this semicolon if your statements are each placed on a separate line. For example, the following code could be written without semicolons:
a =index.html 3; b = 4;
But when formatted as follows, the semicolons are required:
a =index.html 3; b = 4;
Omitting semicolons is not a good programming practice; you should get in the habit of using them.
file: /Techref/language/java/script/definitive/ch02_03.htm, 3KB, , updated: 2019/10/14 15:00, local time: 2024/11/14 23:45,
18.116.51.102:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/language/java/script/definitive/ch02_03.htm"> [Chapter 2] 2.3 Optional Semicolons</A> |
Did you find what you needed? |