Home > Web Front-end > JS Tutorial > body text

Grammar rules for declaring variable names in JavaScript_javascript tips

WBOY
Release: 2016-05-16 15:50:52
Original
1073 people have browsed it

1. Grammar rules

 1. Variables must start with a letter, underscore (_) or dollar sign ($).

 2. Then you can use any number of English letters, numbers, underscores (_) or dollar signs ($).

 3. JS keywords and reserved words cannot be used.

2. Examples

  var score;
  score="100";

Copy after login

3. Attention

 1.JS is case-sensitive. For example, the variables score and Score are different and equivalent to two variables.

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

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template