Javascript Code Standards: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 21: | Line 21: | ||
= Function Definitions = | = Function Definitions = | ||
Function definitions should all be full definitions with no shorthand/arrow notation: <pre>function function_name(parameter_1, parameter_2)</pre> | Function definitions should all be full definitions with no shorthand/arrow notation: | ||
<pre> | |||
function function_name(parameter_1, parameter_2) { | |||
// code goes here | |||
} | |||
</pre> | |||
= In-line Callbacks = | = In-line Callbacks = | ||
Revision as of 17:08, 26 October 2022
Naming Conventions
Local Variables
Local variable names should all be lower case:
If the local variable name is made up of multiple words, use snake case:
email_address
Functions
Function names should all be lowercase:
update
If the function name is made up of multiple words, use snake case:
update_by_id
Classes
Class names should all be capitalized:
Vertical
If the class name is made up of multiple words, use Pascal case:
VerticalGroup
Function Definitions
Function definitions should all be full definitions with no shorthand/arrow notation:
function function_name(parameter_1, parameter_2) {
// code goes here
}
In-line Callbacks
In-line callbacks should utilize shorthand/arrow notation:
button.addEventListener('click', (event) => {
// code goes here
});