Abide by the following rules when writing your code:
- 2-spaced tabs
- NO trailing white spaces (or extra lines)
- NO commented out code that is not being used
- Make useful comments to explain your code
- Use semicolons!!
- Be sure to modularize your code
- Name your variables appropriately
- Use a space before curly braces (for function definitions, conditionals, and loops) i.e.
function() {}
,for(..) {}
- Structure your if/else statements with the
else if
andelse
on the same line as the previous conditional block's closing brace as follows:
if(...) {
} else if(...) {
} else {
}
- Always use
{}
for your conditionals:
// BAD
if(...)
return true;
else
return false;
// GOOD
if(...) {
return true;
}
else {
return false;
}