SOURCE

const person = {
    name: '小明',
    age: 12,
    hobby: 'sing'
}

const proxy = new Proxy(person, {
    get: function (target, propKey, reciever) {
        console.log(`读取了${propKey}`)
        return Reflect.get(target, propKey)
    },
    set: function (target, propKey, value, receiver) {
        console.log(`修改了${propKey}`)
        return Reflect.set(target, propKey, value)
    },
    deleteProperty: function (target, propKey, receiver) {
        console.log(`删除了${propKey}`)
        return Reflect.deleteProperty(target, propKey)
    }

});

console.log(proxy.age)
proxy.age = 30
delete proxy.hobby
console.log(proxy)
console 命令行工具 X clear

                    
>
console