javascript原型链继承

2021-11-08 11:31:10 浏览数 (2)

代码语言:javascript复制
function user(names,age,jobs){                     
if(this instanceof user){
this.names=name;
this.age=age;
this.jobs=jobs;
}
else{
return new user(name,age,jobs)
}
}
admin.prototype=new user();
function admin(namek,pass){
user.call(this,'jcomey','28','design');
console.log(this);
this.namek=name;
this.pass=pass;
}
var fuck=new admin();
alert(fuck.jobs);                                         

0 人点赞