I agree with what Twey wrote (nice to see you again). I would add that, just as an example using the one you offered:
Code:
statement1;
statement2;
if (conditions) {
statement3;
}
That could be written:
Code:
statement1;
statement2;
if (conditions)
statement3;
And then one might be tempted to do this:
Code:
statement1;
statement2;
if (conditions);
statement3;
But it will cause an error, at least in browsers that don't error correct it for you while parsing it.
The semicolon is for the end of a line of code (not necessarily a line of text in the code), usually a statement, so this would be fine:
Code:
statement1;
statement2;
if (conditions) {
statement3;
};
The comma is for separating common things like a bunch of arguments, a line of variable declarations, or a line of property assignments, items in an array. When I say line here, again I mean a code line, not necessarily a line of text in the code.
Bookmarks