# ES6 Proxy vs Getters & Setters

**URL:** <https://forum.kirupa.com/t/es6-proxy-vs-getters-setters/638547>\
**Category:** Uncategorized\
**Created:** [July 27, 2018, 3:55pm UTC](https://forum.kirupa.com/t/es6-proxy-vs-getters-setters/638547 "2018-07-27T15:55:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayut](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kayut](https://forum.kirupa.com/u/kayut)\
**Post date:** [July 27, 2018, 3:55pm UTC](https://forum.kirupa.com/t/es6-proxy-vs-getters-setters/638547/1 "2018-07-27T15:55:19Z")

</div>

Hey,

I just read about ES6 Proxy.  
It sounds to me as it does the same what you can do with getters and setters.  
Is Proxy in ES6 an alternative for getters and setters?

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 27, 2018, 6:01pm UTC](https://forum.kirupa.com/t/es6-proxy-vs-getters-setters/638547/2 "2018-07-27T18:01:00Z")

</div>

It’s similar, but it can do more. Getters and setters, for example, only work for a specific property that you need to setup beforehand. Proxy, on the other hand, can work for any arbitrary property assignment. It can also handle `new` calls, deleting properties, and a few other things too. Enough things that there is no ES5 equivalent so Proxy can’t be properly transpiled to support older browsers through things like Babel.

---

<div class="post-metadata">

**Author:** ![kayut](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kayut](https://forum.kirupa.com/u/kayut)\
**Post date:** [July 27, 2018, 6:52pm UTC](https://forum.kirupa.com/t/es6-proxy-vs-getters-setters/638547/3 "2018-07-27T18:52:35Z")

</div>

Thanks for the explanation. But I didn’t get the last sentence.  
Are you saying that Proxy cannot be transpiled to support older browsers?

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 27, 2018, 8:11pm UTC](https://forum.kirupa.com/t/es6-proxy-vs-getters-setters/638547/4 "2018-07-27T20:11:34Z")

</div>

> [@senocular](#):
>
> Proxy can’t be properly transpiled to support older browsers

> [@kayut](#):
>
> Are you saying that Proxy cannot be transpiled to support older browsers?

I thought so. Was that not clear? 😉

> **Unsupported feature**  
> Due to the limitations of ES5, Proxies cannot be transpiled or polyfilled. See support in various JavaScript engines.

> **[Learn ES2015 · Babel](https://babeljs.io/docs/learn/)**
>
> This document was originally taken from Luke Hoban's excellent es6features repo. Go give it a star
