Connecting Tech Pros Worldwide Help | Site Map

semicolon style

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 07:01 PM
Larry__Weiss
Guest
 
Posts: n/a
Default semicolon style

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

  #2  
Old July 23rd, 2005, 07:02 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default 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.'
  #3  
Old July 23rd, 2005, 07:02 PM
Alexis Nikichine
Guest
 
Posts: n/a
Default 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.
  #4  
Old July 23rd, 2005, 07:06 PM
Douglas Crockford
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.