Class naming
Example:
var ClassName = function(){ //类名
var _FieldName = "Test Field"; //私有变量
this.PropertyName = "Test Property Name"; //属性
var functionName = function(){ //私有方法
return "";
}
this.PublicFunctionName = function(pTestName){ //公有方法 pTestName:参数
var condition = "condition"; //局部变量
if(condition){ //判断
return functionName();
}else{
}
var nameCol = ["a","b"]; //数组
var nameItem = nameCol[0]; //数组项
for(var i = 0; i < nameCol.length; i++){
//循环
}
var selectName = "item";
switch(selectName){ //选择
case "item":
break;
}
}
}
Description
. Name all names by Shong
A: Add _ Underscore prefix B: lowercase opening C: Uppercase opening D: Plus lowercase p prefix
| Name |
A |
B |
C |
D |
| Class name |
|
|
√ |
|
| Private variable |
√ |
|
|
|
| Property |
|
|
√ |
|
| Private method |
|
√ |
|
|
| Public method |
|
|
|
|
| Parameters |
|
|
|
√ |
| Local variables |
|
√ |
|
|
Special Example: array, after adding col;
An array item, followed by an item;
Judgment statement:
if(condition){
//Code;
}else{
//Code;
}
Loop statement:
for(var i = 0; i < nameCol.length; i++){
//Code;
}
SELECT statement:
var selectName = "item";
switch(selectName){
case "item":
break;
}