employee

function employee(name,age){     //JS里面无论什么类型都是function

this.name=name;                         

this.age=age;

}

employee.prototype={                  

constructor:employee,      

sayName:function(){ alert(this.name) };

};

var employee1=new employee("111",19);

alert(employee1.sayName()); 

posted @ 2018-11-11 19:06  vella柚子  阅读(336)  评论(0编辑  收藏  举报