Connecting Tech Pros Worldwide Forums | Help | Site Map

semicolon style

Larry__Weiss
Guest
 
Posts: n/a
#1: Jul 23 '05
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

Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 23 '05

re: semicolon style


Larry__Weiss <lfw@airmail.net> writes:
[color=blue]
> If I code JavaScript as if it were C code with respect to the use of
> semicolons, are there any caveats?[/color]

It might be more readable, and you will not be able to omit a semicolon
that is actually needed.
[color=blue]
> I understand that I will be typing a few more semicolons than
> absolutely needed.[/color]

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 - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Alexis Nikichine
Guest
 
Posts: n/a
#3: Jul 23 '05

re: semicolon style


Larry__Weiss wrote:[color=blue]
> 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.[/color]

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/groups?threadm=4176576c$0$20869$626a14ce@news.free .fr

Alexis

--
somedomain is free.
Douglas Crockford
Guest
 
Posts: n/a
#4: Jul 23 '05

re: semicolon style


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

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

http://www.JSLint.com
Closed Thread