//面向对象的封装与抽象
function User(name,age){
let data={name,age};//写法独特也可以写成这样this.name=name; this.age=age;
let info=function(){
return data.age>50?"老年":"青年"
};
this.show=function(){
console.log(data.name+info());
};
}
let xj=new User("xiangjun");
this.name="houdunren";
xj.info=function(){
return "";
}
xj.show()