JavaScript variable names are subject to two simple rules:
1. The first character must be a letter, an underscore (_), or a dollar sign ($).
2, the remaining characters can be underlined, dollar sign or any letter or numeric character.
Name Method:
1, camel notation-the first letter is lowercase, the next words are capitalized letters begin. Such as:
var mytestvalue = 0, Mysecondtestvalue = "HI";
2, Pascal notation--The first letter is capitalized, the next words are capitalized letters start. Such as:
var mytestvalue = 0, Mysecondtestvalue = "HI";
3. Hungarian type notation--Appends a lowercase letter (or lowercase alphabetical sequence) to a variable named after the Pascal notation, indicating the type of the variable. For example, I represents an integer and S represents a string, such as:
var imytestvalue = 0, Smysecondtestvalue = "HI";
The common prefixes are listed below:
Type |
Prefix |
Example |
Array |
A |
Avalue |
Boolean type |
B |
Bfound |
Floating-point type |
F |
Fvalue |
Function |
Fn |
Fnmethod |
Integral type |
I |
Ivalue |
Object |
O |
Otype |
Regular expressions |
Re |
Repattern |
String |
S |
Svalue |
Variable |
V |
Vvalue |
This article links http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20120608/28903.html