理解prototype—原型链

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();

 

 

 

 
posted @ 2017-03-01 17:52  VictoriaChen  阅读(132)  评论(0编辑  收藏  举报