---
# System prepended metadata

title: '[筆記] Proxy'
tags: [JAVASCRIPT]

---

---
tags: JAVASCRIPT
---
# [筆記] Proxy

[文件](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Proxy)
[參考](https://medium.com/%E4%B8%80%E5%80%8B%E5%B0%8F%E5%B0%8F%E5%B7%A5%E7%A8%8B%E5%B8%AB%E7%9A%84%E9%9A%A8%E6%89%8B%E7%AD%86%E8%A8%98/javascript-%E4%BD%BF%E7%94%A8-proxy-%E7%82%BA-object-%E4%BB%A3%E7%90%86%E9%80%B2%E8%A1%8C%E5%89%8D%E8%99%95%E7%90%86-b6add61b0995)

```javascript=
obj = new Proxy(目標物件, handler物件);
```

```javascript=
const handler = {
    set: (obj, key, value)=>{
        ...
        return ...
    },
    get: (obj, key) => return key in obj ? obj[name] : 37;
};

```