class Per{
// 公有属性
name;
// 私有属性
#age; // => this.#age;
#width;
constructor(name, age, width){
this.name = name
this.#age = age
this.#width = width
}
info(){
console.log(this.#age)
return this.#age
}
}
const p = new Per('ppp',18,102)
访问私有属性
p.#age
这个属性必须出现在类里面
只能在构造函数内部访问
p.info() //18