JavaScript Variable Hungarian Naming act
Hungarian name French law:
Variable name = Type + Object description
Type refers to the type of the variable
Object description refers to the name of an object or part of a name, requires a clear meaning, the name is easy to remember easy to understand.
Tip: Although JavaScript variables do not have a type on the surface, JavaScript is given the appropriate type for the variables inside.
Hint: Hungarian nomenclature was invented by a Microsoft programmer, and most c,c++ programs use this naming method.
JavaScript variable Hungarian named type
javascript variable name type |
variable naming prefix |
Array arrays |
A |
float float |
L |
function functions |
F |
Integer (int) integral type |
N |
Object objects |
O |
Regular Expression Regular |
R |
String strings |
S |
JavaScript Variable name Hungarian naming Method Example
var sweburl= "Www.jb51.net";
From the name of the variable you can see that s represents the string Weburl is the URL.
var ncheckcount=5;
From the name of the variable, you can see that n represents an integer (integer), and Checkcount represents a quantity.
Using Hungarian nomenclature is very simple and intuitive, easy to judge the types of variables, but also facilitate the reading and maintenance of the program.