eg:
//类 构造函数
function Person(name){
this.name = name;
}
//实例化
var p1 = new Person3();
//创建原型对象
Person3.prototype.age = "23";
Person3.prototype.say = function(){
alert(this.name+":"+this.age)
}
p1.say();
eg:
//类 构造函数
function Person(name){
this.name = name;
}
//实例化
var p1 = new Person3();
//创建原型对象
Person3.prototype.age = "23";
Person3.prototype.say = function(){
alert(this.name+":"+this.age)
}
p1.say();