const ido1 = { name:"张三", phone:10086, price:10000 } class agent { get(){ return "经纪人电话10010" } set(obj){ if(obj.key == 'price'){ //经纪人过滤资质 if(obj.value < ido1.price) throw new Error("报价过低") ido1.price = obj.value } } } let agent1 = new agent(); let message = agent1.get(); console.log(message); let obj = { key:"price", value:"100000000" } agent1.set(obj) console.log(ido1)