Obj2.{ x, y } = Obj1 Destructuring Assignment

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

  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. :-|

1 Like

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

1 Like