class Person{ value = "html" get val(){ return this.value; } set val(value){ this.value = value } }var p = new Person("cheng",18);p.val = "good"; //调用set方法console.log(p) console.log(p)