getter / setter
class Parent { constructor(name,age){ this.name = name; this.age =age; } set age(num){ console.log('setter') if(num>100){num=100} this._age = num; } get age(){ return this._age; } }实例化
var p = new Parent("mumu",18); p.age = 180; p.age; // 100