Style Guide
Explore JavaScript style guidelines to write cleaner code by choosing meaningful names, following naming conventions like camelCase, and using linters for code quality. This lesson helps you understand how proper styling and formatting improve readability and reduce errors in your JavaScript projects.
Style guide {#style-guide}
Here are the coding rules and principles used throughout the course:
This chapter is by nature subjective and opinionated. Feel free to make your own choices.
Naming
Naming things right goes a long way into making code cleaner and easier to understand. Some general naming rules are presented below.
1. Choose meaningful names
The most important rule is to give each element (variable, function, class, etc) a specific name that reflects its role. A variable holding the value of a circle radius should be named radius rather than num or myVal. ...