JavaScript declares the syntax rules for variable names

  • 2020-07-21 06:58:11
  • OfStack

1. Grammar rules

1. Variables must begin with a letter, an underscore (_), or a dollar character ($).

2. It can then be composed of any number of Letters, Numbers, underscores (_), or dollar characters ($).

3. JS keywords and reserved words cannot be used.

Example 2.


  var score;
  score="100";

3. Pay attention to

JS is case sensitive. For example, the variables score and Score are not the same and are equivalent to two variables.

2. Although variables can be used directly without declaration, they are not standardized and involve such issues as variable name promotion.

This is the end of this article, I hope you enjoy it.


Related articles: