6 rules to name variables correctly

A developer reads code more often than writes it. In addition, not your own but created by others ? Therefore, unsuccessful names of variables — special "repositories" in which information can be placed can significantly increase time spent. So it's important to name them so that you and your team can understand the code at a glance, even months later.

Rule 1.

Name the variables so that there is no need for comments. And they were as straightforward as possible without context and additional code study.

Rule 2.

The variable name must include letters, numbers, an underscore, and a $ sign.

Rule 3.

Do not use transliteration. Name the variables only in English. If there are problems with the language, use a translator.

Rule 4.

Do not call variables by one letter, do not use abbreviations, and avoid abbreviations except generally accepted ones.

Rule 5.

Capitalize every word except the first. Remember that variables are case-sensitive.

Rule 6.

The variable name should briefly describe its purpose. Use those that are easy to read.

Rule 7.

Do not use JavaScript-reserved words as variable names.