Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q615 How do I know when to include the semi-colon (;) at the end of a line?

irt.org | Knowledge Base | JavaScript | General | Q615 [ previous next ]

Q615 How do I know when to include the semi-colon (;) at the end of a line?

Semi-colons are optional. However, if you join two statements onto one line then you'll need a spearating semi-colon:

var x = 1; x = x + 1;

Which is the same as:

var x = 1
x = x + 1

It is always best to include semicolons:

var x = 1;
x = x + 1;

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.