Rules must be followed by: (, do not obey is wrong
1. The name of a variable can be Numbers, yu mother, English underlined O), the dollar sign ($)
2. Strictly case-sensitive
3. Not by digital beginning, do not use Chinese characters named
4. Can't be a reserved word or keywords
Don't appear blank
5.
Specification: (recommended to comply with (the developers default), do not obey not error
1. The variable name to meaningful (semantic)
2. Follow the hump naming rules, made up of multiple words, from the second word began to capitalize the first letter, such as countNum
The definition of a variable
Variables: data storage containers
Variable declaration: var num;
Variable assignment: num=10
Define variables:
Display definition:
Var num1=10
The console. The log (num1)
The implicit definition:
Num2=20
The console. The log (num2)
The distinction between two kinds of definitions:
According to defined in the absence of the assignment can be used, the print is undefined, and implicit definition in the absence of assignment complains, implicitly define variables at the time of use must be ascribed value
CodePudding user response:
CodePudding user response:
Suggest bloggers to arrange for a blog event better