SOURCE

let p = {
    name: "zf",
    age: 23,
    name_ : "q",
    get name() {
        return `my name is ${this.name_}`
    },
    set name(v){
        this.name_ = `[${v}]`
    }
}
p.name  = "zf"
// const des = Object.getOwnPropertyDescriptor(p,"name")
console.log(p.name)
// console.log(des.value)
console.log(
Object.getOwnPropertyDescriptors(p)
); 

let book = {
    year_:2017,
    edition:1,
    get year(){
        return this.year_
    },
    set year(newValue){
        if (newValue > 2017) { 
            this.year_ = newValue; 
            this.edition += newValue - 2017; 
        } 
    }
};  
book.year = 2019
console.log(
Object.getOwnPropertyDescriptors(book)
); 
console 命令行工具 X clear

                    
>
console