camelCase is used for function
and method
names
function thisIsMyFunctionName() {...}
var fullName = "Test";
PascalCase is used for type
names
Use concise names!
Use JSDoc style comments when documenting code
/** This function will display "Hello World" */
function showHelloWorld() {
alert("Hello World");
}
For code blocks it is recommended to start the opening curly brace at the end of the current line and put the closing brace on a separate line indented at the same level as the starting block of code.
if (true) {
if (someCondition) {
// Code here...
}
else if (something else) {
// More code here...
}
}