动态原型链

function Person(age,name){
       this.age=age;
       this.name=name;
       if(typeof Person._initialized=='undefined'){
             Person.prototype.showName=function(){
                     console.log(this.name);
             }
             Person._initialized=true;
        }
}

 

posted @ 2016-08-26 18:49  G善源  阅读(81)  评论(0编辑  收藏  举报