Is semicolon needed in Java Script? horror of ;

Short answer is NO in recent times, here is why
The semicolon is used to separate statements, but it can be omitted if the statement is followed by a line break.
The semicolon is needed, only when you have two or more statements on the same line, not other wise ๐Ÿ™‚ 

    var i = 0; i++        // <-- semicolon obligatory
                          //     (but optional before newline)
    var i = 0             // <-- semicolon optional
        i++               // <-- semicolon optional

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.