By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,619 Members | 1,732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,619 IT Pros & Developers. It's quick & easy.

semicolon style

P: n/a
If I code JavaScript as if it were C code with respect to the use of semicolons,
are there any caveats? I understand that I will be typing a few more semicolons
than absolutely needed.

- Larry Weiss
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Larry__Weiss <lf*@airmail.net> writes:
If I code JavaScript as if it were C code with respect to the use of
semicolons, are there any caveats?
It might be more readable, and you will not be able to omit a semicolon
that is actually needed.
I understand that I will be typing a few more semicolons than
absolutely needed.


Which is good :) Go right ahead. I also recommend always using {..}
around blocks of if's, while's, etc., even if they only consist of
one line.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2

P: n/a
Larry__Weiss wrote:
If I code JavaScript as if it were C code with respect to the use of
semicolons,
are there any caveats? I understand that I will be typing a few more
semicolons
than absolutely needed.


Don't put an end-of-line separating a return statement from its operand,
since this will insert an extra, absolutely unneeded, semicolon.

http://groups.google.fr/gr**************************************@news.free .fr

Alexis

--
somedomain is free.
Jul 23 '05 #3

P: n/a
> If I code JavaScript as if it were C code with respect to the use of
semicolons,
are there any caveats? I understand that I will be typing a few more
semicolons
than absolutely needed.


You can use JSLint to determine that all of the semicolons are well placed.

http://www.JSLint.com
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.