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);                                         
none
最后修改于:2015年12月22日 22:24