一小时学会js-b站笔记

Javascript中代理的代码示例: 

// Proxy 代理
const obj = {name:'吴昊',age:18}
// const container = document.getElementById()
const p1 = new Proxy(obj,{
    get (target,property,receiver) {
      return obj[property]
    },
    set (target,property,value) {
      obj[property] = value
    }
})

console.log(p1.name)

你可能感兴趣的:(前端,javascript,开发语言)