SoFunction
Updated on 2025-03-04

Introduction to naming rules based on identifiers in JavaScript

There are the following rules for naming identifiers in JavaScript:

Composed of letters, numbers, $, _

Start with letters, $, _

Reserved words cannot be used! ! !

Make sense! ! ! ! ! ! !

Naming specification for identifiers:

1. Hump nomenclature

Except for the first word of the identifier, the first letter of the rest of the words is capitalized, for example: trueName

2. Snake type nomenclature

Separate words with _, for example: true_name

(Note: In most cases, identifiers starting with 1 to 2 underscores represent special variables or internal variables. When we define ourselves, try to avoid using variables starting with underscores)

(Super basic opinions, please criticize and correct me)

The above introduction to the naming rules for identifiers in JavaScript is all the content I share with you. I hope you can give you a reference and I hope you can support me more.