topic: Clean Code For JavaScript

Tags clean-code javascript
Hard Prerequisites
IMPORTANT: Please review these prerequisites, they include important information that will help you with this content.
  • TOPICS: General Clean Code Guidelines
  • JavaScript Naming Conventions

    There is an introduction about JavaScript Naming Conventions here with examples, which gives you the common sense when it comes to naming variables, functions, classes or components in JavaScript. No one is enforcing these naming convention rules, however, they are widely accepted as a standard in the JavaScript community.

    We do expect you to put effort into keeping your code clean and tidy. So please follow these conventions.

    For most of your early work, you’ll be naming functionsLikeThis and variablesLikeThisToo. The first letter is small, and then every word in the name starts with a capital letter.

    ClassesAreNamedLikeThis, we’ll get there a bit later :)

    Use ESLint and Prettier (if you can)

    If you are coding on your phone then this tool might not be available to you.

    ESLint is a quality tool that inspects code and warns a developer about potential problems. It is available online and can also be integrated into several development environments, so errors will be highlighted when writing code. It also has rules that relate to better ways of doing things to help you avoid problems.

    If you install the VSCode Prettier plugin then you can set it up to format your code prettily every time you hit save. This saves a lot of time.


    RAW CONTENT URL