js中实例方法、静态方法和原型方法
function FUNC(data){
this._data=data;
// 实例方法
this.GetData=function(){
console.log("my name is "+name);
GetId();
}
// 私有方法
var GetUserName = function(){
console.log("I have no id..");
}
}
// 类方法 静态方法 static
FUNC.sendMsg=function(){
console.log("sendMsg!");
}
// 原型方法
FUNC.prototype.receiveMsg=function(){
console.log("receiveMsg!");
}
//测试
var ceshi= new FUNC("data");
ceshi.GetData();// 实例方法只能实例调用,内部方法只能被内部的方法调用
FUNC.sendMsg();//静态方法只能被类调用
ceshi.receiveMsg();//原型方法只能被实例调用