JavaScriptStyle
JavaScriptStyle
Coding Conventions
https://www.w3schools.com/js/js_conventions.asp
https://www.w3schools.com/js/js_best_practices.asp
Variable Names
Use camelCase for identifier names (variables and functions).
Camel case convention means typing the words in lower-case, only capitalizing the first
letter in each word.
Code Indentation
Always use 2 spaces for indentation of code blocks:
Statement Rules
General rules for simple statements:
If a JavaScript statement does not fit on one line, the best place to break it, is
after an operator or a comma.
Naming Conventions
Always use the same naming convention for all your code. For example:
File Extensions
HTML files should have a .html extension (not .htm).
This will: