Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | General | Q615 [ previous next ]

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;

©2018 Martin Webb