# Obj2.{ x, y } = Obj1 Destructuring Assignment

**URL:** <https://es.discourse.group/t/obj2-x-y-obj1-destructuring-assignment/1582>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [January 7, 2023, 3:46pm UTC](https://es.discourse.group/t/obj2-x-y-obj1-destructuring-assignment/1582 "2023-01-07T15:46:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0X-JonMichaelGalindo](https://avatars.discourse-cdn.com/v4/letter/0/4af34b/32.png) [@0X-JonMichaelGalindo](https://es.discourse.group/u/0X-JonMichaelGalindo)\
**Post date:** [January 7, 2023, 3:46pm UTC](https://es.discourse.group/t/obj2-x-y-obj1-destructuring-assignment/1582/1 "2023-01-07T15:46:30Z")

</div>

Allow assignment of properties from one object to another using destructuring / structuring.

```plaintext

  let a = { x:1, y:2 };

  let b = { z:3 };

  b.{ x, y } = a;
  //b is now { z:3, x:1, y:2 }

```

Currently, `.{` is a syntax error, so this syntax is unambiguous.  
And its meaning is so intuitive, that this post does not even have any more explaining to do. :-|

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/senocular/32/642_2.png) [@senocular](https://es.discourse.group/u/senocular)\
**Post date:** [January 8, 2023, 7:24pm UTC](https://es.discourse.group/t/obj2-x-y-obj1-destructuring-assignment/1582/2 "2023-01-08T19:24:56Z")

</div>

I've seen this in at least one of the few pick/omit-like proposals floating around. This one I dug up real quick includes it: [GitHub - jfet97/tc39-proposal-dotstructuring: Proposal: Object dotstructuring](https://github.com/jfet97/tc39-proposal-dotstructuring)

---

<div class="post-metadata">

**Author:** ![blob](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/blob/32/2230_2.png) [@blob](https://es.discourse.group/u/blob)\
**Post date:** [April 4, 2023, 11:30am UTC](https://es.discourse.group/t/obj2-x-y-obj1-destructuring-assignment/1582/3 "2023-04-04T11:30:53Z")

</div>

I LOVE THIS. Looks like a shortcut to `{x: b.x, y: b.y} = a;` and this is just great! I would actually make big use of this

---

<div class="post-metadata">

**Author:** ![NoM](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/nom/32/1716_2.png) [@NoM](https://es.discourse.group/u/NoM)\
**Post date:** [April 13, 2023, 3:51am UTC](https://es.discourse.group/t/obj2-x-y-obj1-destructuring-assignment/1582/4 "2023-04-13T03:51:42Z")

</div>

It's beautiful. This should totally be a thing. I've often wished this was possible.
