-
Notifications
You must be signed in to change notification settings - Fork 13
Code Conventions
frimmel edited this page Aug 16, 2012
·
3 revisions
All 'if' tests should explicitly test what the expected value should be.
// INCORRECT
if (x) {
foo;
} else {
bar;
}
// CORRECT
if (x !== undefined) {
foo;
} else {
bar;
}
With the exception of serialization code all quotation marks for strings should be double quotes. Serialization code requires double quotes to be serialized so all quotation marks for strings should be single quotes.
Indentation should be four spaces per level, and should only use spaces with no tab characters.
All 'if', 'for', 'while' statements and 'function' declarations should include a space between the keyword and the opening paren.