Chapters
JavaScript Coding Standards
Semicolons
Use them. Never rely on Automatic Semicolon Insertion (ASI).
Blocks and Curly Braces
if, else, for and while blocks should always use braces, and always go on multiple lines. The opening brace should be on the same line as the function definition, the conditional, or the loop. The closing brace should be on the line directly following the last statement of the block.
JavaScript ES6+
As much as possible, we strive to use JavaScript ES6 (at the time of writing). For example, this means using:
constandletovervar.- Arrow functions:
const myFunction = () => {}
Components
For readability and maintainability, it is important to use components. There are examples of this in our boilerplate, but this essentially means using export and import. For example:
myFunction.js:
main.js: