Sonia
07-25-2003, 01:15 PM
Is a semicolon compulsory after each statement in JavaScript?
If no, why do we use semicolons in JavaScript statements at all?
If no, why do we use semicolons in JavaScript statements at all?
|
Click to See Complete Forum and Search --> : semicolons Sonia 07-25-2003, 01:15 PM Is a semicolon compulsory after each statement in JavaScript? If no, why do we use semicolons in JavaScript statements at all? pyro 07-25-2003, 01:18 PM Semi-colon are not necessary for the most part in javascript. Most of us probably use them out of habit. I'm also a PHP programmer, and forgetting a semi-colon in that will not be pretty... Sonia 07-25-2003, 01:21 PM You said 'most part of JavaScript'. Therefore there are some places where it is compulsory? pyro 07-25-2003, 01:29 PM Yes, take this example (two function calls in an onclick): <a href="#" onclick="one() two() return false">test</a> That will not work, we need to use: <a href="#" onclick="one(); two(); return false">test</a> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |